Jesus was counted a son of David by the reckoning of Joseph’s lineage, not by that of Mary’s. All the emphasis is on Joseph’s Davidic descent, not only in Matthew (1:16, 20) but also in Luke (1:27; 2:4). Although Jesus was not the natural son of Joseph, through Mary, who was engaged to Joseph, he was civilly and legally the son of Joseph (Luke 2:27, 41, 48) and inherited from him the rights to David’s throne. Also for that reason Joseph was warned by God to take Mary as his lawful wife, to act as head and father of the family, and in that capacity to give the child the name “Jesus” (Matt. 1:18–21). Thus Christ became David’s son and simultaneously remained David’s Lord.
The exclusion of the man from his conception at the same time had the effect that Christ, as one not included in the covenant of works, remained exempt from original sin and could therefore also be preserved in terms of his human nature, both before and after his birth, from all pollution of sin. As subject, as “I,” he did not descend from Adam but was the Son of the Father, chosen from eternity to be the head of a new covenant. Not Adam but God was his father. As a person he was not the product of humankind but himself came to humankind from without and entered into its ranks. And since he thus, in God’s righteous judgment, remained exempt from all original sin, he could be conceived by the Holy Spirit and by that Spirit remain free from all pollution of sin. Conception by the Holy Spirit was not the deepest ground and final cause of Jesus’ sinlessness, as many theologians say, but it was the only way in which he who already existed as a person and was appointed head of a new covenant could now also in a human way—in the flesh—be and remain who he was: the Christ, Son of God the Most High.
Reformed Dogmatics Volume 3: Sin and Salvation in Christ (Grand Rapids, MI: Baker Academic, 2006), p. 294-295.