A 93rd-minute header from Bruno Alves gave Portugal an unconvincing 1-0 win over Mexico on Friday.
The Fenerbahce defender found himself free at a late Joao Moutinho set-piece at the Gillette Stadium in Foxborough and headed past a helpless Guillermo Ochoa.
With Cristiano Ronaldo still missing due to injury, Paulo Bento's men had lacked a creative spark until the late winner.
Portugal, who were held to a 0-0 draw by Greece last time out, face the Republic of Ireland on Tuesday before their World Cup campaign begins against Germany on June 16.
As expected, Portugal were without key trio Ronaldo, Pepe and Raul Meireles in Massachusetts.
Miguel Herrera started with Manchester United striker Javier Hernandez on the bench, while Rafael Marquez – who had been under an injury cloud – returned to the centre of defence.
Mexico pressed high up the pitch early on, but Portugal created an opportunity in the 14th minute as Vieirinha's strike was kept out by Jose de Jesus Corona.
Portugal forward Eder had the best chance of the first half when he was played through, but Mexico scrambled the danger away with Corona swatting the ball away.
Eduardo was forced into a save in the Portugal goal soon after as he tipped away a goal-bound cross from the left.
Eder looked the most likely to score in an uninspiring first half and he had another chance six minutes before the break, only to put Joao Pereira's cross wide.
Bento's men almost took the lead in the 50th minute.
A Nani corner eventually fell to Fabio Coentrao in the area, but the Real Madrid defender's low strike was kept out by substitute goalkeeper Guillermo Ochoa at his near post.
Just five minutes later, Mexico almost found an unlikely opener from range.
Hector Herrera played a square pass to Andres Guardado, whose powerful 25-yard drive went inches wide.
Hernandez needed just three minutes to have an impact off the bench as he almost set up Hector Herrera a minute after the hour-mark.
The striker's cross to the back post from the left found the Porto man, who took a neat touch before forcing Eduardo into a strong save from an angle.
The lively Hector Herrera tried his luck from range in the 68th minute, and Eduardo was up to the task once more to deny him.
Hernandez set up substitute Alan Pulido for a glorious chance in the 89th minute.
Played in behind, Hernandez unselfishly squared for Pulido, but Eduardo was quick off his line to smother at the forward's feet in a one-on-one.
But there was to be late drama as slack marking saw Alves rise in the area to head in Moutinho's free-kick from the right.
Mexico had their moments ahead of their first World Cup clash against Cameroon on June 13, while Portugal have one more friendly to improve their attack.
|10||G. dos Santos|
|Coach: M. Herrera|
for José Corona 46'
for G. dos Santos 58'
for A. Guardado 78'
for O. Peralta 78'
for H. Herrera 85'
|Goalless Muller was the best player, says Ancelotti after thrashing|
|Phil Neville backs Rashford to match Griezmann|
|Juventus 2 Empoli 0: Champions cruise to 10-point gap at summit|
|Howe refusing to panic as Bournemouth´s struggles continue|
|Zarate was making the difference before injury - Mazzarri|
|I owe him my eternal gratitude - Vardy´s emotional Ranieri tribute|
|Cantona: Ibrahimovic is like me|
|Watford 1 West Ham 1: Ayew halts injury-hit hosts|
|Napoli 0 Atalanta 2: Caldara double stuns Sarri´s men|
|Ancelotti: It was a perfect day|
|Championship review: Newcastle drop points, Leeds clip Owls´ wings|
|Allardyce hails Van Aanholt and Sakho|
|Koeman lays into ´lucky´ Everton´s second-half display|
|Conte: We still need 29 points for Premier League title|
|We need an Aubameyang who does not think too much - Tuchel|
|Guingamp 1 Monaco 2: Glik, Fabinho on target|
|Marco Silva blames lack of focus as Hull remain in drop zone|
|Lukaku becomes Everton´s joint leading Premier League scorer|
|Real Betis 1 Sevilla 2: Sampaoli´s men heap pressure on Real Madrid|
|RB Leipzig 3 Cologne 1: Hosts capitalise on errors to stay hot on Bayern´s heels|
|Hull City 1 Burnley 1: Keane on target as 10-man Clarets end dire away run|
|Chelsea 3 Swansea City 1: Fabianski´s error helps Premier League leaders move 11 points clear|
|Neuer reaches 100 Bundesliga clean sheets for Bayern in record-breaking fashion|
|Everton 2 Sunderland 0: Unhappy Goodison return for Moyes as Lukaku wraps it up|
|West Brom 2 Bournemouth 1: McAuley winner piles pressure on Howe|
|Crystal Palace 1 Middlesbrough 0: Van Aanholt proves difference in nervy basement battle|
|Luis Enrique dismisses claims of dressing room discontent at Barcelona|
|Bayern Munich 8 Hamburg 0: Lewandowski hits hat-trick in special day for Ancelotti|
|Freiburg 0 Borussia Dortmund 3: Aubameyang back in the goals with a brace|
|#Piegate bites back as Sutton are forced to use outfield player in goal|
|Schmeichel denies players met with Leicester board to get Ranieri sacked|
|Spalletti would not swap Dzeko for Icardi|
|Emery understands Marseille rivalry and hopes PSG can repeat Barca win|
|Ibrahimovic better than ever and could play on until he turns 40 - Mourinho|
|Simeone: Barcelona still the best team in the world|
|A-League Review: Victory stay in Sydney hunt, Roar slip up at home|
|Zidane hopes potential France return will boost Benzema|
|I have not talked to anyone at Leicester - Mancini on replacing Ranieri|
|LaLiga teams raise their game against Real Madrid, claims Zidane|
|Arrivederci, Claudio! Ranieri says his final Leicester goodbyes|
|Soldado expects Real Madrid to come out fighting after Valencia loss|
|Montella hoping to remain AC Milan coach despite impending takeover|
|Valencia hopes EFL Cup triumph can inspire late title charge|
|Pele´s son vows to clear his name after being jailed for money laundering|
|Wijnaldum highlights Kante loss as crucial to Leicester´s downfall|
|Lyon rejected chance to sign Sakho, says Aulas|
|Koeman hopes Southampton lose EFL Cup final to boost Everton´s European hopes|
|Mata insists Manchester United will not take EFL Cup final for granted|
|Simeone´s Atletico starting to decline, Abbiati claims|
|Chelsea´s Fabregas ´100 per cent´ staying at Stamford Bridge|
|´Being Joey´ - Dyche talks up Barton TV show|
|Messi the best of all time, says Jovetic|
|You can define an era - Buffon wishes Donnarumma happy birthday|
|Clement: Llorente wants to star against Chelsea|
|Koeman not interested in Everton renewal amid Barca links|
|Rivals scared of Ibrahimovic, says United team-mate Herrera|
|Schmeichel pays tribute to Ranieri|
|Yaya Toure wants to play with Neymar and Coutinho|
|Mourinho: It´s more difficult to win now|
|I didn´t sleep for six days – Conte motivated by last-gasp title loss|
|It all depends on success - Klopp knows trophies are a must|
|Barkley targets finishing above Liverpool|
|Championship Review: Birmingham ease pressure on Zola with derby win|
|Mourinho could start Rooney in EFL Cup final|
|Comeback kid Le Bihan moves Nice level with Monaco|
|Leicester job an amazing opportunity - Rowett pitches to replace Ranieri|
|Deschamps free to pick Benzema, Le Graet reveals|
|Valencia request new time for Barcelona fixture|
|Rabona-fide brilliance! Watch Kovacic´s marvellous strike in Real Madrid training|
|Hull´s Silva cools Hernandez CSL rumours|
|Frustrated Allardyce accepts Palace players are struggling|
|Sampaoli tells Sevilla to learn from Real Madrid errors in ´most important game of the year´|
|Raiola ready to cut off Balotelli´s tongue after latest red card|
|My dream died after Leicester sack - Ranieri|
|Schalke sign Bentaleb from Tottenham|
|Puel welcomes Mkhitaryan´s EFL Cup final absence|
|Arsenal chairman concedes Gunners are playing for pride against Bayern|
|Melbourne City 1 Sydney FC 3: Bobo double helps leaders back to winning ways|
|Kohler refuses to write off Gotze|
|Ranieri will be remembered in 2,000 years, says Mancini|
|You don´t owe anyone - Henry tells Rooney to make China move if it makes him happy|
|I was not an Italian spy! - No ulterior motive for Conte in Eddie Jones meeting|
|Inter coach Pioli expects tight Roma clash|
|Mourinho: Leicester should name stadium after Ranieri|
|Conte: Ancelotti the best Italian coach in the world|
|Carrick in, Mkhitaryan out for Manchester United in EFL Cup final|
|Klopp compares Ranieri sacking to Trump, Brexit triumphs|
|Ranieri did not lose Leicester dressing room, insists Shakespeare|
|Conte willing to risk sack to lead Chelsea to Premier League glory|
|Disapponting for managers around the world - Premier League bosses react to Ranieri sacking|
|Ribery ready for Bayern Munich comeback|
|Celtic fined for Manchester City crowd trouble|
|Vardy´s goal decline and Mahrez´s assist struggles: The Opta stats behind Ranieri´s Leicester demise|
|Bayern boss Ancelotti vows never to repeat middle finger gesture|
|Medel urges Sanchez to quit Arsenal for Inter|
|Europa League draw: Manchester United to play Rostov, Lyon v Roma|
|Aubameyang dry spell worries me - Tuchel|
|Varane a doubt for Napoli as Real Madrid confirm muscle injury|
|Leicester job favourite Mancini: I am sorry for my friend Ranieri|
|Allegri welcomes back Bonucci following apology|
|Montella targets lengthy AC Milan stay|
|Lineker cries after Ranieri is sacked|
|Ranieri sacking ´the biggest shock in a decade´|
|Wenger ´witch-hunt´ has gone too far, says Bilic|
|Lewandowski better than Benzema, Suarez, Costa - Matthaus|
|Sticks and Stones may break my bones - Man City defender unhurt by criticism|
|Atletico Madrid v Barcelona: Simeone´s men primed to land on punch-drunk Barca|
|Pogba no machine like Messi or Ronaldo, says Mata|
|Oxlade-Chamberlain adamant Arsenal ´more than capable of competing for title´|
|Monaco star Falcao was almost lost to baseball|
|FC Dallas 4 Arabe Unido 0: Champions League semis beckon for Americans|
|No gratitude in football - Spalletti saddened by Ranieri sacking|
|Alli not to blame for Tottenham´s Europa League exit - Pochettino|
|Mourinho pays tribute to axed Leicester boss Ranieri|
|Europa League Review: Spurs crash out, Stindl stuns Fiorentina, Lyon destroy AZ in record-equalling|
|Bastia punished over Balotelli abuse|
|Eriksen blames Tottenham´s shock Europa League exit on poor finishing|