Anglo-Portuguese relations fall apart first than goes Poland-Lithuania. Or royal marriage. Succession war maybe.
As to a royal marriage there are three I can think of off the top of my head.
1) Catherine of Braganza was proposed as a bride D. Juan of Austria the Younger. Let her brothers die without issue (maybe young too). He becomes king of Portugal in her right, and then king of Spain in 1700 (because he's got the New World's money to back him).
2) Luiza Isabel 'la Sempre-Noiva', Princess of Beira, was proposed as a match for Carlos II. If both have a better health, and Carlos produces an heir, then Spain and Portugal are united in their son - *Carlos III.
3) The double marriage between D. Felipe V's son and daughter and D. Joao V's son and daughter. For Barbara to become queen of Portugal her brothers need only be born female, or not live past infancy. She has a bit of better luck with her 1733 pregnancy, and voila - Bourbon Iberian Union.
NOTE: I know these aren't likely - but some just to tickle your brain