Sin is an offense (primarily) against God. As such, being God, Jesus can forgive sins. This is what the scribes and Pharisees were offended at–that a mere human claimed to forgive sins, outside of the “officially sanctioned” methods from the Torah.
There may seem to be a problem in that Jesus has not yet made his saving sacrifice on the cross, but that, to me, gets too much into dividing up and finding where exactly this or that happened. We Catholics tend to do this, for example, when we ask, “How much of the Mass is a minimum to count as attending Mass?” (Old answer: if you arrive before the Gospel, and stay through the Consecration, or maybe Communion. On the other hand, if you are really intent on an intimate relationship with God, the whole question is odd: would you ask “What’s the minimum time I can spend with my friend for it to count”?)
Jesus taking on human nature in the incarnation, all the way to his Passion and resurrection, is one movement of salvation, including forgiveness of sins. He came to forgive sins and restore us to life in God, to bring the Kingdom of God alive on Earth. All of that is found in all that he did, to greater or lesser extent. If he forgave sins a short time before he suffered for sins, is that any more amazing than that we can still partake of his sacrifice here, thousands of miles away, and thousands of years later?