The Americans survived an 11-minute scoreless start before Maggie Steffens put in three goals and the rest of the offence got rolling to edge China 7-6 on Friday in the teams' last preliminary-stage game of the London Olympics.
"You never know when you're going to be a little cold offensively and that's why we always talk about our defence and making sure our defence is playing consistently," U.S. coach Adam Krikorian said. "You want to be able to survive those quarters or moments, the times in the game when you go cold offensively, and luckily our defence was the key today.
"I thought we were much better today, and we just keep getting better, which is obviously a good sign for us moving forward."
With the win, the U.S. finished the preliminary round even with Spain at the top of Group A with five points. But Spain earned the top seed with the tiebreaker — they beat third-place Hungary by more points than the U.S. did — making the Americans the group's second seed for the knockout stage.
The Americans will play 2012 European champion Italy, which finished third in Group B, in Sunday's quarterfinals.
With the quarterfinal seeding already set before the game began, the Americans started off slow against China and trailed 3-1 more than halfway through the second quarter.
But the Americans then cranked things up on defence to hold China scoreless for 14 minutes. Steffens, meanwhile, heated up on the offensive end of the pool, scoring three goals over that stretch to take her tournament tally to 11.
Annika Dries and captain Brenda Villa also chipped in with a goal each to give the U.S. a 6-3 lead late in the fourth quarter.
"With USA we really want to shut people down on defence and show people who we are," Steffens said. "Offense will come no matter what — we're going to be able to put the ball in the net at some point — but we need to stop the other team and really shut them down on defence."
While the U.S. has played solid defence for long stretches of games in London, it has also had mental lapses at times that have proven costly.
Against Spain, the Americans let a 9-6 lead in the last three minutes slip away and had to settle for a draw, which ultimately cost them the top seed in the group.
On Friday against China, the Americans had a similar lapse late in the fourth quarter, giving up three goals in a two-minute stretch. This time, however, they buckled down and held on to win.
Looking back at the game against Spain, goalkeeper Betsey Armstrong said the U.S. learned from its mistakes.
"It was disappointing to lose that lead against Spain and finish with a tie against them, and it really taught us that there's no letting up, any sort of pause in focus can change the game completely in the matter of a possession or two," she said.
"So we really hashed that out in video and hashed that out in the past couple of days since that game. I think as soon as that moment you feel it, you're up a couple of goals, you just need to remind each other and we did a good job of doing that to finish the game."
The U.S. fell to the second spot in the group after Spain got a last-second goal from Anni Espar Llaquet to beat Hungary 13-11 and give them the two-goal difference they needed to take the top.
It was a huge win that provided a major confidence boost for a young team from Spain, which is making its Olympic debut in women's water polo.
"It's the first time we have come to the Olympics, and we have come here not just to play but to win," Espar Llaquet said. "We train a lot so I think that we deserve to be there, fighting with teams like Australia or USA."
In the quarterfinals, Spain will be without coach Miguel Angel Oca, who received a red card against Hungary and will be suspended for Sunday's game against winless Britain.
For China, Friday's loss to the U.S. brought an end to a disappointing group stage. The 2011 world championship runners-up finished winless and last in Group A in London. They will play Group B winner Australia in Sunday's quarterfinals.
Considered the Americans' biggest rival for the title coming into the Olympics, Australia locked up the top seed in Group B by beating previously undefeated Russia behind four goals from Nicola Zagame.
"We've come here for one job, and that's to get the gold medal, so just six games — three down — and just ticking the boxes really as we keep going," Zagame said. "Hopefully we'll finish on the podium, hopefully on the top."
Russia dropped to second in the group and will play Hungary in Sunday's quarterfinals.
Ryan Lucas can be reached on twitter at www.twitter.com/relucaszSuggest a correction