As Jesus was in Mary's womb, the Angel of the Lord appeared in a dream/vision to Joseph on 3 occasions (the NASB reads "an angel of the Lord" Matt 1:20), while Matt 2:12 says the Magi "having been warned by God in a dream."
Matthew 2:13
ESV - 13 Now when they had departed, behold, an angel of the Lord appeared to Joseph in a dream and said, "Rise, take the child and his mother, and flee to Egypt, and remain there until I tell you, for Herod is about to search for the child, to destroy him.
For follow-up discussion and general commentary on the topic. Comments are sorted chronologically.