Spain deserves more credit for Portugal's success than we usually give them.
Every time Portugal was getting a little too comfortable, Spain would kindly remind us why having a strong army, good fortifications, and a healthy distrust of our neighbours was important.
They even tried running Portugal between 1580 and 1640. Unfortunately, the Portuguese weren't particularly impressed with the management, so we organised a change of leadership. No referendum, no lengthy negotiations. Just a new king and a polite request for Spain to leave.
To this day, Spain remains Portugal's most dedicated supporter of national unity. Nothing brings the Portuguese together quite like a Spaniard suggesting we're basically the same country.
For that, we thank them.