ANSWER: The last words of Jesus came when he finished the work God gave him to do. He became the perfect lamb of God that made possible the New Covenant or agreement between Godhead and man. By willingly offering himself as the atoning sacrifice to take away the sins of the world, he made possible an eternal life of joy and happiness to ALL those who repent and obey the Almighty.
If we consider what John recorded in chapter 19 and verses 26 to 27 as a single statement, we have seven unique last phrases (or "words") spoken by Jesus. The first two of his statements made from the cross come from the 23rd chapter of the book of Luke. Jesus first stated, "Father, forgive them, for they do not know what they are doing" (Luke 23:34, HBFV throughout). His second statement is, "Truly, I tell you today, you shall be with Me in paradise" (verse 43).
The third (or fourth, depending how you count) of his last statements comes when Jesus notices the apostle John standing with his mother Mary. He says the following to her, "Woman, behold your son" (John 19:26). He then looks at John and says, "Behold your mother" (verse 27). At this point it should be noted that, in regard to Bible prophecy, both Luke 23:48 - 49 and Matthew 27:55 - 56 confirm that King David's statement that the family and friends of Jesus would see his suffering from a distance (Psalm 38:10 - 11) was fulfilled.
His fourth of seven final words is his cry, found in the book of Mark chapter 15 and verse 34, to God the Father asking why he was forsaken. He said the following, loudly, at 3pm, "ELOI, ELOI, LAMA SABACHTHANI?" Interestingly, Matthew records a slightly different version of this cry to God when he writes it was, "ELI, ELI, LAMA SABACHTHANI?" (Matthew 27:46).
The next two statements or 'words' spoken by our Savior (his fifth and sixth), as he was dying on the cross for the sins of humanity, are found in the book of John. They fulfill the prophecy that Christ would be given vinegar (sour wine) to drink (Psalm 69:21). Jesus, who knew that he has successfully completed the most important part of God's great plan for man, said "I thirst" (John 19:28). After receiving something to wet his lips he cried out, "It is finished" (verse 30).
The seventh and final statement uttered by Jesus while he was human also fulfilled prophecy. Raising his voice to the level where everyone could hear, he said "Father, into Your hands I commit My spirit" (Luke 23:46). King David, many centuries prior, had predicted what his final earthly statement would be (Psalm 31:5). Jesus, the Savior of mankind, God in the flesh, after he gave these last prophetic words, died.