USA, the current champions, are out of the World Cup on penalties in front of more than 27,000 fans in Melbourne. Lina Hurtig’s spot‑kick sent Sweden to the quarter-finals, helped significantly by the brilliance of Zecira Musovic between the sticks. It is the first time in the tournament’s history that USA have been eliminated at this early a stage.

In the end, it came down to a matter of millimetres as Alyssa Naeher desperately clawed at the final penalty but failed to keep it out. “It’s a tough moment,” Vlatko Andonovski, the USA head coach, said.

“It just shows how cruel this game can be sometimes and how small details make the difference between winning and losing. I am so proud of the team. I know we were criticised for the way we played … I think we came out today and were all about the grit, the resilience.”

Andonovski’s side had attracted widespread criticism in the lead-up to this match. Uncharacteristically lacklustre performances against the Netherlands and Portugal had prompted questions about the team’s and the manager’s tactical capabilities. On the night they looked much improved but could not make their dominance count, going out after the match finished goalless following extra time.

The absence of Rose Lavelle, one of their key creators, due to suspension did little to ease worries. It forced Andonovski into two changes, with Emily Sonnett coming in while the rising star Trinity Rodman replaced Lynn Williams.

They faced a Sweden team who were one of only three sides to have won all of their games so far. Peter Gerhardsson returned to the starters that served him so well in the 5-0 defeat of Italy, with the attacking trio of Stina Blackstenius, Fridolina Rolfö and Johanna Rytting Kaneryd returning.

‘Sick joke’: Megan Rapinoe and Alyssa Naeher react as USA exit Women’s World Cup – video

This USA team are not used to being written off and it was clear from the start that the week’s commentary had lit a fire under them. They surged around the pitch, forcing their opponents back and into uncharacteristic errors. Smith and Rodman were finding space, their youthful enthusiasm pushing USA forward.

They had Sweden on the ropes in the first half, with only last-ditch tackles, shaking crossbars and the alertness of Musovic keeping them at bay. Andi Sullivan flashed a shot wide early on before Rodman had an effort parried. The defence backed off the 21-year-old livewire every time she advanced.

Sweden's Zecira Musovic denies the USA’s Alex Morgan

Sweden’s Zecira Musovic denies the USA’s Alex Morgan during her heroic performance in goal. Photograph: Hannah McKay/Reuters

USA’s best opportunity fell to their captain, Lindsay Horan, who was attacking the game with typical determination. Sweden are known for their ability at set pieces but the Lyon midfielder almost played them at their own game, leaping high only to see her header crash off the woodwork. Despite their domination though, they failed to find a breakthrough, leaving Sweden with a glimmer of hope.

The break did little to sap USA’s liveliness. Despite being faced with a higher Swedish press, they swarmed forward at every opportunity. It was only Musovic’s brilliance in goal that kept it level, at times the keeper putting up a one-woman wall. The pick of the bunch was a cat-like reaction to tip away an instinctive Horan effort.

It was unfortunate for the current champions that Rodman was on only limited minutes because of illness last week. Arguably the best American on the pitch, her replacement by Williams allowed Sweden to take a breath. Gerhardsson’s team were happy to bank up and try to pick their opponents off on the counter.

Zecira Musovic

The substitute Sofia Jakobsson almost did just that, advancing with a dazzling display of footwork to force Naeher into a rare save. Down the other end, her goalkeeping counterpart was excellent once more, keeping out Alex Morgan from point-blank range to see the tie into extra time.

Sweden showed more intent early on, but the game settled into the same rhythm as USA continued to create. Musovic still delivered fine stops to keep out both Morgan and Williams once more. And as tiredness set in, the game drifted towards penalties.

The shootout was filled with drama. There were wayward spot‑kicks on both sides but the image of Megan Rapinoe skying her effort in her final appearance in a USA shirt will linger.

Hurtig stepped up to win it 5-4 for Sweden to set up a quarter-final date with Japan. “They are very skilful,” the Sweden manager said. “It’s going to be a different kind of game … We want to have the attitude to win the ball, but we have to accept that they are passing and hold them away from our goal.” Auckland will host the game next Friday, a meeting of two of the tournament’s most in-form teams.