Chris Wondolowski and Chris Pontius also scored goals for the MLS All-Stars at PPL Park, the home of the Philadelphia Union.
Frank Lampard and John Terry scored for Chelsea, the touring English Premier League team, selected to play in the All-Star game.
Los Angeles Galaxy star David Beckham received the loudest pregame ovation only hours after arriving from London. Beckham, his pink shoes as bright as the lights that lit up the field, was set to head back to London immediately after the game because he has a role in the opening ceremony at the Olympics.
Beckham thrilled the fans when he set up for a free kick, though the ball was headed out. Beckham failed to score on his subsequent corner kick.
For the rest of the All-Stars who aren't London bound, playing just outside Philadelphia was the next best thing. Plus, there was a taste of London outside of PPL Park where the globally popular Blues had a pair of championship trophies stationed in a tent and a line of fans waiting to pose next to them for some pictures.
Fans packed the entertainment area where kids could kick around balls, and everyone from Tony Meola to Freddy Adu signed autographs.
A stadium-record 19,236 fans packed the state-of-the-art stadium nestled on the bank of the Delaware River.
The Sons of Ben, the Union's popular fan club, beat drums and sang songs all game long, then led a rousing ovation when Union defender Carlos Valdes checked in off the bench. They also made a "Landykake" sign in the form of the logo of Philadelphia's popular Tastykake snack line.
The fans also delighted in chanting "your captain is a racist" at Terry. Terry, the Chelsea captain, was acquitted July 13 in London's Westminster Magistrates' Court of charges he racially abused Queens Park Rangers defender Anton Ferdinand during a Premier League game last October.
D.C United coach Ben Olsen led the MLS All-Stars and saw a familiar scene in the 73rd minute when United teammates Dwayne De Rosario and Pontius connected for the tying goal. De Rosario made a sharp pass to Pontius and he pounded it past Ross Turnbull for the tying score. Pontius was the game's MVP.
Chelsea, in the midst of a U.S. tour, had scored two straight goals to seemingly take control of game.
Lampard scored in the 58th minute when he was open off an arching pass and easily booted the ball into the net for a 2-1 lead. Terry had scored a header in the 32nd minute to make it 1-1.
Wondolowski, the San Jose star who leads MLS with 17 goals, took advantage when Chelsea failed to clear the ball and left an open net for a goal in the 21st minute.
But just when the game appeared on the brink of being decided by penalty kicks, Johnson, of the Seattle Sounders, broke free for the winner and sparked the MLS All-Stars to a win over an international team for the first time since 2008.
The MLS stars celebrated as "Philadelphia Freedom" was blasted through the stadium.