Barcelona took the lead in the first match of their Asian tour, a friendly to mark the one-year countdown to the 2008 Olympics, with a curling left-foot shot from Mexican teenager Giovani dos Santos in the 10th minute.
Andres Iniesta made it 2-0 just before the hour mark before Ronaldinho sealed the win.
The Brazilian, probably the most popular player in China, had twisted his ankle in training on Saturday but he came on for the second half in place of new signing Thierry Henry.
In the 78th minute, Barcelona won a free kick about 25 metres from goal and the 30,000 fans at the Fengtai Stadium got what they came for as the twice former World Player of the Year took almost no run-up before curling the ball into the net.
"I was satisfied with the game," Barcelona coach Frank Rijkaard told reporters. "We weren't able to play our best but the team accomplished what they wanted to."
The stadium was three-quarters full despite ticket prices of up to 1,808 yuan -- a month's salary for many Beijingers.
One 24-year-old woman from Sichuan province said she had been sent "almost crazy" at seeing the Brazilian's goal.
"I saved up for four months to come to the match and did shifts for my colleagues to get the time off," she added, before rushing off to the train station to start her 30-hour trip home.
As part of the campaign to stamp out bad behaviour at sporting events before next year's Olympics, Beijing police had said they would arrest fans guilty of swearing or fighting.
The match, however, was played in a good atmosphere with the rowdiest element being three American students who roamed the stands giving vocal support to the home team.
Barcelona play Yokohama F-Marinos in Japan on Tuesday and a Mission Hills XI in Hong Kong on Friday on their whirlwind tour.