How did Matthew conclude that Isaiah 7:14 refers to Jesus? The verse reads: "Therefore the Lord himself shall give you a sign; Behold, a virgin shall conceive, and bear a son, and shall call his name Immanuel." Matthew quotes it in Matthew 1:23, with it's fulfillment in Jesus' birth. 

But when we read the context in Isaiah 7:1-17, we find that the sign is in reference to God telling King Ahaz that the Assyrians will come against Israel, and the 7:14 sign is to indicate something about when it will happen. 7:8-9 tells us that Ephraim will be broken in 65 years; 7:15-16 tells us that something will happen while the child of 7:14 is still young. 

In what way can this passage of scripture be likened to Jesus' situation so that it reasonably applies to him? Since Matthew believes Jesus is the Christ, and this passage refers to Jesus, I am asking for answers from likeminded writers as to how this passage can apply. Perhaps Matthew had a similar point of view in mind. 

Here are the verses:

Isa 7:1-9 


  And it came to pass in the days of Ahaz the son of Jotham,
  the son of Uzziah, king of Judah, that Rezin the king of Syria, and
  Pekah the son of Remaliah, king of Israel, went up toward Jerusalem to
  war against it, but could not prevail against it.
  
  And it was told the house of David, saying, Syria is confederate with
  Ephraim. And his heart was moved, and the heart of his people, as the
  trees of the wood are moved with the wind.
  
  Then said the LORD unto Isaiah, Go forth now to meet Ahaz, thou, and
  Shearjashub thy son, at the end of the conduit of the upper pool in
  the highway of the fuller's field;
  
  And say unto him, Take heed, and be quiet; fear not, neither be
  fainthearted for the two tails of these smoking firebrands, for the
  fierce anger of Rezin with Syria, and of the son of Remaliah.
  
  Because Syria, Ephraim, and the son of Remaliah, have taken evil
  counsel against thee, saying,
  
  Let us go up against Judah, and vex it, and let us make a breach
  therein for us, and set a king in the midst of it, even the son of
  Tabeal:
  
  Thus saith the Lord GOD, It shall not stand, neither shall it come to
  pass.
  
  For the head of Syria is Damascus, and the head of Damascus is Rezin;
  and within threescore and five years shall Ephraim be broken, that it
  be not a people.
  
  And the head of Ephraim is Samaria, and the head of Samaria is
  Remaliah's son. If ye will not believe, surely ye shall not be
  established.


Isa 7:10-17 


  Moreover the LORD spake again unto Ahaz, saying,
  
  Ask thee a sign of the LORD thy God; ask it either in the depth, or in
  the height above.
  
  But Ahaz said, I will not ask, neither will I tempt the LORD.
  
  And he said, Hear ye now, O house of David; Is it a small thing for
  you to weary men, but will ye weary my God also?
  
  Therefore the Lord himself shall give you a sign; Behold, a virgin
  shall conceive, and bear a son, and shall call his name Immanuel.
  
  Butter and honey shall he eat, that he may know to refuse the evil,
  and choose the good.
  
  For before the child shall know to refuse the evil, and choose the
  good, the land that thou abhorrest shall be forsaken of both her
  kings.
  
  The LORD shall bring upon thee, and upon thy people, and upon thy
  father's house, days that have not come, from the day that Ephraim
  departed from Judah; even the king of Assyria.
Since all scripture is inspired by God1, no one comprehends it except by the Spirit of God2.

There are at least a couple of ways from scripture that may have enabled St. Matthew to present what he was writing as a fulfillment of the Isaiah passage.


Since he was the Gospel writer, by the inspiration of the Holy Spirit, God, who inspires all scripture, and
Since he was an Apostle, when the LORD opened their minds to understand the scriptures3.


Were he not an Apostle, the third way to know would have been from they to whom it had been given to know the secrets of the kingdom of God4 as was the case with the Ethiopian Eunuch to whom Philip, beginning with a passage from Isaiah, told of the good news of Jesus5.

1. cf. 2 Tim 3:16 (RSVCE).
2. cf. 1 Cor 2:11 (RSVCE).
3. cf. Luke 24:45 (RSVCE).
4. cf. Luke 8:10 (RSVCE).
5. cf. Acts 8:26-40 (RSVCE).   



Please see also bruisedreed's answer. It's an excellent addendum.