Here's the whole genealogy from the King James translation:-
Matthew 1
1 The book of the genealogy of Jesus Christ, the Son of David, the Son of Abraham:
2 Abraham begot Isaac, Isaac begot Jacob, and Jacob begot Judah and his brothers.
3 Judah begot Perez and Zerah by Tamar, Perez begot Hezron, and Hezron begot Ram.
4 Ram begot Amminadab, Amminadab begot Nahshon, and Nahshon begot Salmon.
5 Salmon begot Boaz by Rahab, Boaz begot Obed by Ruth, Obed begot Jesse,
6 and Jesse begot David the king. David the king begot Solomon by her who had been the wife[a] of Uriah.
7 Solomon begot Rehoboam, Rehoboam begot Abijah, and Abijah begot Asa.
8 Asa begot Jehoshaphat, Jehoshaphat begot Joram, and Joram begot Uzziah.
9 Uzziah begot Jotham, Jotham begot Ahaz, and Ahaz begot Hezekiah.
10 Hezekiah begot Manasseh, Manasseh begot Amon,and Amon begot Josiah.
11 Josiah begot Jeconiah and his brothers about the time they were carried away to Babylon.
12 And after they were brought to Babylon, Jeconiah begot Shealtiel, and Shealtiel begot Zerubbabel.
13 Zerubbabel begot Abiud, Abiud begot Eliakim, and Eliakim begot Azor.
14 Azor begot Zadok, Zadok begot Achim, and Achim begot Eliud.
15 Eliud begot Eleazar, Eleazar begot Matthan, and Matthan begot Jacob.
16 And Jacob begot Joseph the husband of Mary, of whom was born Jesus who is called Christ.
The New International translation is easier to read regards that that last part:-
16 and Jacob the father of Joseph, the husband of Mary, and Mary was the mother of Jesus who is called the Messiah
It's interesting to note that from Abraham all the way down to Joseph (husband of Mary) we have an exclusively male descendancy. Just from the pattern of it, it is odd that Mary is mentioned at all. Note that it is a Jewish custom to list geneaolgies via the male parent only, as this one does right until the end.
Note that another Jewish (and Christian) custom is that when a man marries his wife, then they, in the eyes of God become one flesh.
Strange then that the end of the geneology diverges, somewhat conspicuously, to state Mary was the mother of Jesus. Why does it suddenly depart from the normal male line of descendancy? Why does it NOT clearly state that Joseph was the father of Jesus in keeping with the normal pattern of the genealogy? The reason is that the male human part of the marriage (Joseph) was not involved in the conception of Jesus. It was the Spirit Of God that created the physical incarnation of The Son of God (Who is eternally part of the Godhead) in Mary's womb.
That said, the descendancy works fine since through marriage, Joseph and Mary were one flesh.
Finally, it is clear from verse 16 that Jesus, Son of Mary, is the Christ/Messiah. That's what the text says. How can you read it any other way?