The New Testament, like the Old, also has two main original language words that are translated as "sin." The word hamartia (Strong's #G266), which appears 174 times in the Greek text, means to commit an offense (transgression). The second word, hamartano (Strong's G264), occurs 43 times, and means to "miss the mark."
Thayer's Greek Definitions states both hamartia and hamartano have equivalent meanings defining sin which are "to make an error or wander from the path of uprightness."
The most basic definition of sin is that it is any thought, attitude or action contrary to God's will and his perfect character of love.
Sin includes the breaking of any of his commandments (1John 3:4, Romans 7:12 - 13, James 2:10 - 11, etc.), whether in "the letter" (their narrow meaning based on what is written) or in their spiritual intent (their full intended meaning).
Scripture also defines sin as knowing to do good and not doing it (James 4:17) as well as anything not done in faith (Romans 14:23). All unrighteousness is considered sinful (1John 5:17). It should be noted that since God is the standard by which all that exists is measured and judged, all transgressions are foremost against him (Psalm 51:4) even when they greatly affects others.
Letter versus Spirit
Jesus, after selecting the twelve men who would become his inner-circle of disciples, gave his most often-quoted message known as the Sermon on the Mount. One of the main goals of this message was to reveal the full meaning behind the definitions of sin taught in the Old Testament.
One of the teachings Jesus expanded upon was the seventh commandment, found in Exodus 20:14, which forbade the sin of adultery.
You have heard that it was said to those in ancient times, 'You shall not commit adultery.' But I say to you, everyone who looks upon a woman to lust after her has already committed adultery with her IN HIS HEART (Matthew 5:27 - 28, HBFV).
Jesus' teaching offers an excellent contrast between what God required under the Old Covenant and the depth of obedience expected under the New Covenant. A "letter of the law" interpretation of the seventh commandment defines the physical act of sex outside the marital union as sin.
Jesus' explanation, however, shifts the focus of disobedience to a person's thoughts and attitudes. Sin is now imputed to humans (whether they are married or not!) if they harbor lustful thoughts toward another person, even if they do not act upon their strong desires!
Why does it matter?
Why is God not only concerned about the external (physical) manifestations of sin but also the internal thinking and attitudes that lead to them? It is because man was created with the potential to live forever in a spirit-based, not flesh-based, body!
All humans who repent, build character through obedience, etc. will, in a resurrection, be given spirit-based bodies in order to live forever. Each human has the potential to receive the same spirit-based existence and righteous character as the Godhead.
Sin separates man from God and cuts him off from the one relationship needed in order to learn how to live a full and productive life - both now and in the future. This breach can be healed through the sacrifice of Jesus Christ.
Through repentance and accepting his sacrifice as payment for our disobedience, we can establish a close and personal relationship with our Maker and Father. Believers are guaranteed they will be forgiven, and continue under his grace, as they seek his will in their lives.
If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness (1John 1:9, NIV)
Consequently, there is now no condemnation to those who are in Christ Jesus, who are not walking (living their lives) according to the flesh (following human nature's inclinations to sin), but according to the Spirit (God's righteous way of living - Romans 8:1, HBFV).