Luiz de Vasconcelos e Sousa, 3o count de Castelo Melhor (born 1636—died August 15, 1720) was a Portuguese royal favourite who, as effective governor of Portugal from 1662 to 1667 during the reign of Afonso VI, was responsible for the successful prosecution of the war against Spain, which led, in 1668, to Spanish recognition of Portugal’s independence.
Shortly after Afonso VI’s coming-of-age in 1662, the King appointed Castelo Melhor his secret notary (escrivão da puridade), a position in which the favourite was able to exercise the functions of first minister. Castelo Melhor overcame the difficulties which had hitherto beset Portugal in the war against Spain, reorganizing the troops (now reinforced by an English contingent by virtue of the English king Charles II’s marriage to Catherine of Braganza) and entrusting their command to competent generals. Consequently the war entered a victorious phase for Portugal (1663–65) and Spain began peace negotiations. Agreement proved difficult to attain and meanwhile the internal political situation in Portugal deteriorated. The King was obliged to dismiss Castelo Melhor on Sept. 9, 1667, shortly before he himself was deprived of power.
Castelo Melhor went into exile in Paris and then London, but in 1685 he was permitted to return to Portugal and, two years after that, to court. On the accession of John V (1706), he was appointed a councillor of state and he continued to occupy a position of distinction until his death.