Solo also punched Marta's corner away in the final minutes of extra time.
Brazil pressed after the goal, but had few clear shots on Solo with U.S. defenders foiling corners and shots from open play. In the 27th minute of extra time, Lloyd hit the far post to cap the Americans' late surge.
Brazil seems jinxed in big games. In addition to the Olympic final loss four years ago, the South Americans also lost 2-0 to Germany in the World Cup final a year ago.
It was redemption for Solo. In the World Cup semifinals last year against Brazil, she was benched by then-coach Greg Ryan, who went with the veteran Briana Scurry.
The U.S. was battered 4-0. Solo openly criticized Ryan afterward and was kicked off the team. Ryan left the team about a month later, replaced by Pia Sundhage of Sweden.
Both teams were unimpressive in the first 20 minutes Thursday, chasing loose balls on a wet, cutup field soaked by rain that stopped just minutes before the start.
Early possession was a problem, but the Americans struggled more in the face of a Chinese crowd of 51,612 at Workers' Stadium supporting Brazil and chanting "Jiayou you Brazil" (Let's go Brazil).
Then Marta started to dazzle, catching the attention of celebrities in the crowd that included Pele, Los Angeles Lakers star Kobe Bryant and IOC president Jacques Rogge.
Brazil had the game's first scoring chance in the 31st minute. Lloyd gave the ball away in midfield and Formica sent a through-ball to Cristiane, who was stopped by Solo coming out 10 meters to make a sprawling save.
Three minutes later, Marta tantalized the fans with some swiveling step-over moves before slipping past defenders Kate Markgraf and Christie Rampone, but shooting just wide of the near post.
Solo came up with another key save in the 38th, diving to stop a free kick from Marta.
It was Marta again in the 54th who forced Solo into another clutch save. Ten minutes later, later Daniela drove a dangerous free kick from 20 meters into a wall of defenders.
In the 72nd, Marta beat Heather Mitts and Markgraf and drove a shot from close range that Solo saved with her outstretched right arm. Seven minutes later, Solo was forced to punch away Marta's corner.
The U.S. rallied late in regulation and nearly scored three times in the last five minutes.
In the 86th, Barbara punched away a corner from Angela Hucles. Seconds later, Barbara dived to her right to stop Hucles from 20 meters.
Amy Rodriguez almost won it 25 seconds from the end of regulation. Picking up a loose ball she attempted to chip the ball from 20 meters over Barbara, who leaped and tipped the ball wide.
In the earlier game, substitute midfielder Fatmire Bajramaj scored a pair of second-half goals to help world champion Germany beat Japan 2-0 and win its third straight Olympic bronze in women's football.