Velázquez had established his reputation in Seville by the early 1620s. He traveled to Madrid in April 1622, with letters of introduction to Don Juan de Fonseca, chaplain to the King. Velázquez was not allowed to paint the new king, Philip IV, but portrayed the poet Luis de Góngora at the request of Pacheco. The portrait showed Góngora crowned with a laurel wreath, which Velázquez later painted over. He returned to Seville in January 1623 and remained there until August.
In December 1622, Rodrigo de Villandrando, the king's favorite court painter, died. Velázquez received a command to come to the court from Gaspar de Guzmán, Count-Duke of Olivares, the powerful minister of Philip IV. He was offered 50 ducats (175 g of gold) to defray his expenses, and he was accompanied by his father-in-law. Fonseca lodged the young painter in his home and sat for a portrait, which, when completed, was conveyed to the royal palace. A portrait of the king was commissioned, and on August 30, 1623, Philip IV sat for Velázquez. The portrait pleased the king, and Olivares commanded Velázquez to move to Madrid, promising that no other painter would ever paint Philip's portrait and all other portraits of the king would be withdrawn from circulation. In the following year, 1624, he received 300 ducats from the king to pay the cost of moving his family to Madrid, which became his home for the remainder of his life.