One seemed more unlikely than the other, that the United States would win by three goals and that Italy would lose by three goals Sunday in the Confederations Cup. But the highly improbable became the inevitable when the previously struggling Americans defeated Egypt, 3-0, and, against long odds, advanced to the semifinals of the eight-team tournament. They will play Spain, the European champion, on Wednesday. In an energetic and entertaining game, played with desperate inspiration, persistence and optimism, the United States advanced on the tie breaker of total goals scored after Brazil defeated Italy, 3-0. 'I can't imagine many times something like this has happened,' Landon Donovan, the American captain, said. The United States, Italy and Egypt finished group play with 1-2 records, and Brazil won all three of its matches to finish first. Earlier, the Americans lost, 3-1, against Italy, the four-time World Cup winner and defending world champion. But unlike in many sports, head-to-head results are not the primary tiebreaker in soccer tournaments. Instead, the first is the difference between goals scored and goals allowed. The United States and Italy were even at minus-two; Egypt was minus-three. Using the second tiebreaker, total goals scored, the Americans prevailed over Italy by four to three. The United States will now face Spain, which has won 15 consecutive games and is unbeaten in its last 35. Brazil will face South Africa in the other semifinal. On Sunday, the Americans received goals from Charlie Davies, Michael Bradley and Clint Dempsey, scoring during the run of play for the first time in five matches. Importantly, the United States did not fall behind quickly, as it had in a humbling 3-0 loss to Brazil. 'The first two days after the Brazil game, that was probably the feeling: 'We're on our way home,'' Donovan said. 'This morning, I think we woke up and thought, 'You never know what can happen; let's try to score the first goal and see what happens.' ' By Sunday night, the defeats against Italy and Brazil, the five-time world champion, were rendered insignificant. Relieved, too, for the moment anyway, was the mounting criticism of and pressure on coach Bob Bradley. Midfielder Michael Bradley, the coach's son, said in an emotional postgame response: 'At the end of the night, you walk into the locker room, and to be able to experience a feeling like that with your teammates, coaches and trainers, that's why you play, to do something special like that. When everything is against you, everybody wants to say how bad you are, everybody wants to write you off.' To leave those distractions outside the locker room, he said, 'and to be committed as a team to leaving everything on the field, to running for each other, to fighting for each other, that's what we did.' He added: 'All those experts in America, everybody who thinks they know about soccer, can all look at that score tonight and let's see what they have to say now.' Sunil Gulati, the president of the U.S. Soccer Federation, said he had received 200 e-mail messages in recent days, the overwhelming majority demanding that he fire Bob Bradley. Soccer blogs had reflected the same sentiment. 'I don't pay any attention,' Bradley said. 'It goes with the territory. I've coached long enough that my ways of doing things are set. You make sure the players understand there will always be stuff that flies around on the outside but none of it can come on the inside and affect what we're doing. The ability on the inside to put a hard shell around things, to establish trust, and stick to what we're doing, that's what the job is.' Davies started at forward in the belief that his speed would expose the exhaustion that Egypt might feel after a narrow 4-3 defeat to Brazil and its historic 1-0 victory over Italy. Bradley's hunch was prescient. In the 21st minute, after a throw-in from the left flank, forward Jozy Altidore sent a low cross toward the near post. The ball popped free after the Egyptian midfielder Ahmed Fahti slid into the head of the diving goalkeeper Essam El Hadary. Davies kept hustling in the confusion, and ricocheted the ball off of Hadary's face into the net. It was Davies' second goal for the national team. At halftime, the American players were told that Brazil was leading Italy, 3-0. If they could score two more goals, and if the margin in the Italians' game did not change, they would advance. In the 52nd minute, a shot by Altidore was stopped by a hand ball at the goal line, a clear violation that apparently went unseen by the referee. 'There was still a feeling within our team that we had momentum and that we could keep pushing,' Bob Bradley said. In the 63rd minute, the United States took a 2-0 lead on a give-and-go between Michael Bradley and Donovan. Bradley slid into the ball from 10 yards and punched it inside the right goal post. The decisive goal came in the 71st minute, on an impeccable 40-yard cross from Jonathan Spector that Dempsey headed into the net from seven yards. The usually phlegmatic Bob Bradley pumped his arms in celebration. 'This is one of things Americans are capable of,' Donovan said. 'We have a spirit that a lot of people don't. We showed it tonight.' 