The four-time champions were playing with everything on the line but spurned several chances to find the net and the addition of veteran Megan Rapinoe in the second half did little to turn things around against a physical Portugal defence.
They survived a huge scare in stoppage time when Ana Capeta hit the post and another when the striker won a free kick just outside the box a few minutes later but held on in the nerve-searing final minutes of the Group E clash.
Goalkeeper Ines Pereira had no issues stopping forward Lynn Williams' header in the fourth minute and co-captain Alex Morgan fired wide from the middle of the box in the sixth minute.
Williams had another header on target in the 14th minute off a cross from Sophia Smith, but Pereira easily gathered that effort.
In the 27th minute, Williams fired a shot straight at the Portugal keeper and smashed a follow up effort over the crossbar and Pereira was again equal to the task for the forward's final shot of the half in stoppage time.
The addition of winger Rapinoe in the 61st minute and forward Trinity Rodman in the 84th minute failed to revive the US front line.
The stadium let out a collective gasp as Capeta's stoppage-time shot ricocheted off the post and the Americans scrambled together a frantic defence to avoid a once-unthinkable fate in the final moments of the match.
The United States move on to the last 16 in Melbourne, where they will almost certainly face Sweden, after finishing in second place in Group E behind the Netherlands who thrashed Vietnam 7-0.
"It's tough to be second, we wanted to go through first," Morgan said.
"This team gave everything we just didn't put the ball in the back of the net. And then in the last few minutes, we just had to hold it down, we had to get the result and move on, now we move forward."
"It's just not going in the back of the net," Morgan added.
"We have so many corners, we have so many opportunities, we got the crosses, I mean just unlucky you know."