Panama scored a stunning 2-1 upset win over the United States on Saturday to advance to the Gold Cup quarterfinals.

Luis Tejada scored in the 19th minute and Gabriel Gomez converted a penalty kick later in the first half to help lift Panama to its first win in nine matches against the United States.

Clarence Goodson's second-half strike reduced the margin, but it wasn't enough to save the Americans from their first defeat ever in the group stage of the Gold Cup.

Despite the loss, the U.S. can clinch a spot in the quarterfinals by beating Guadeloupe in its final Group C match Tuesday night in Kansas City.

''Sometimes you just come out flat for whatever reason. At this level, and against a good team, you can't do that,'' U.S. star Landon Donovan said, reflecting on the Americans falling behind by two goals in the opening half. ''Some nights you come out flat and you don't get punished, but other nights you do. We learned a valuable lesson.''

Tejada tapped home a rebound after a lunging U.S. goalkeeper Tim Howard blocked Armando Cooper's goal-bound header.

American Tim Ream's foul set up Gomez' penalty kick, which the Panamanian lifted over the diving Howard for a 2-0 lead in the 36th minute.

Goodson gave the U.S. hope for a dramatic comeback, scoring in the 68th minute. The Americans had a couple of opportunities to equalize, but Chris Wondolowski missed in the 80th minute and Jaime Penedo made two saves in injury time to help Panama hang on before a crowd of 27,731.

''In the first half as the game was developing, we had the ball a lot but we weren't able to take advantage of some situations,'' U.S. coach Bob Bradley said.

''What you don't want to do in that situation is go down a goal. You just want to keep doing a good job controlling the ball, controlling the game with the idea that opportunities will come. You put yourself behind, you make it much more difficult.''

The loss was just the second for the Americans in their past 21 Gold Cup games. They had previously had six wins and two draws against Panama, with all the meetings coming in either Gold Cup or World Cup qualifying.

The teams played a scoreless draw in the 2005 final, with the U.S. winning a penalty shootout to take the championship. They met in the quarterfinals in 2007 and 2009, with Panama losing 2-1 each time.

''CONCACAF teams are getting better and better. It's a pretty good team we played against,'' Donovan said. ''It's disappointing, but the reality is it's over now. ... We've got to win Tuesday, see what else happens and see where we end up. We're still fine.''

The U.S. beat Canada 2-0 in its opening match on Tuesday.

Panama opened the tournament with a 3-2 victory over Guadeloupe and beating the Americans gave it consecutive Gold Cup wins for the first time.

Panama coach Julio Dely Valdes said through a translator that this victory was especially gratifying because of the effort that went into finally getting over the hump against the Americans.

''We worked very hard for it,'' the coach said. ''I'm absolutely happy because we made history.''