The United States entered Wednesday’s friendly against the planet’s most accomplished national soccer team with infectious confidence and chemistry after a string of promising results. But the Americans required more than self-belief and harmony to overcome Brazil — even a young Brazilian squad prepping for the Olympics.

The 4-1 result wasn’t as bruising as it sounded, but the Americans were in deep trouble midway through the first half, and despite a stirring response, lost to Brazil for the 16th time in 17 meetings.

Neymar, the next Brazilian sensation, and Thiago Silva scored in the first half in front of 67,619 at FedEx Field, the largest crowd ever to watch a U.S. match in the Washington area.

Herculez Gomez scored for the Americans on the brink of halftime, but Marcelo padded the margin early in the second half and Brazil repelled repeated late threats before Alexandre Pato added the finishing touch.

Juergen Klinsmann praised his team’s resilience but was angered by the officiating and was troubled by the lack of grit.

“We need to get nastier, maybe a little bit still too naive, maybe we don’t want to hurt people,” he said after a five-game winning streak ended. “We have to step on their toes more, get them more frustrated.”

Later, he added: “The first 20 minutes there was too much respect, which is understandable. You’re playing Brazil. We started to get rhythm and we created quite a lot of chances, but you’ve got to put them in as well.”

Gomez also thought the team lacked bite.

“Sometimes you see Brazil on the calendar and you go in with a lot of respect for their players, but they are just like us,” he said. “They bleed, they hurt, so you’ve got to get after it. You saw in the second half when we pressed and imposed our game, they were the ones on their heels, they were the ones trying to hit us, they were the ones sweating and battling and fighting to track back.

“Once we learn we don’t always have to be Mr. Nice Guy, we’re going to be better off.”

As expected, the Americans were under much greater pressure than in their 5-1 romp over Scotland on Saturday.

The match turned when Costa Rican referee Jeffrey Calderon awarded a penalty kick. Leandro Damiao drove the ball into the box. At close distance, Oguchi Onyewu had only a moment to react. The ball was at rib height, at his side, and struck his left elbow, which was just far enough from his body to draw Calderon’s attention.

“I’m amazed he would even call the penalty that early in the game and seeing it wasn’t intentional,” Onyewu said. “By no means was my arm spread out to block the shot.”

Neymar converted for a 12th-minute lead.

Tim Howard prevented further damage with a one-on-one save on Damiao, but in the 26th minute, Brazil took advantage of sloppy marking on a corner kick. As Neymar served the ball, Silva shed Jermaine Jones for a five-yard header.

Just before halftime, Michael Bradley threaded the ball to Fabian Johnson for an end-line cross that deflected off a sliding defender and popped up to Gomez for a header at the edge of the goal line – his third goal in 10 U.S. appearances.

Seven minutes after the break, the Brazilians countered with punishing efficiency: Marcelo linked with Hulk, who slotted to Neymar for a cross to Marcelo. Unmarked at the six-yard box, Marcelo finished with a sliding shot.

Seven minutes after entering, Clint Dempsey had a golden chance to score, but Romulo cleared Gomez’s header from the six-yard box before the Fulham star could capitalize. Pato hit the left post in the 66th minute.

Brazil’s Rafael preserved the two-goal lead with sterling saves on Gomez, Terrence Boyd and Bradley. Pato’s blistering effort in the 87th ended the drama.

“I’ve been in some games that were 4-1, 4-0, and you feel like you got pasted,” Howard said. “Tonight wasn’t one of those games.”

U.S. notes: In a pregame ceremony, former World Cup captains Tony Meola and Claudio Reyna, D.C.-born defender Desmond Armstrong, women’s coach Tony DiCicco and journalist Grahame Jones were inducted into the National Soccer Hall of Fame. . . . The Americans will play Canada in a friendly Sunday in Toronto, while Brazil will face Mexico at sold-out Cowboys Stadium.