"After the exile to Babylon: Jeconiah was the father of Shealtiel, Shealtiel the father of Zerubbabel, Zerubbabel the father of Abihud, Abihud the father of Eliakim, Eliakim the father of Azor, Azor the father of Zadok, Zadok the father of Akim, Akim the father of Elihud, Elihud the father of Eleazar, Eleazar the father of Matthan, Matthan the father of Jacob, and Jacob the father of Joseph, the husband of Mary, and Mary was the mother of Jesus who is called the Messiah." NIV translation
As we see, Matthew does not say that Joseph was the father of Jesus. But, he demonstrates that legally Jesus was his son and therefore a direct descendant of King David. In this section of the family tree, we see the restoration of Israel. Although the way for the restoration has been paved, it has not fully taken place yet as the full measure of God's people have not accepted Him as the Messiah. This will happen in the last days and, in fact, is the focus of the Book of Revelation.