An almost full-strength Brazil team got off to a sloppy start at Harare's National Sports Stadium but picked up the pace to earn a comfortable victory less than two weeks before its World Cup debut.
The five-time world champion suffered a scare when goalkeeper Julio Cesar went off with a back injury in the 26th minute. The Champions League winner with Inter Milan left the field walking, and team doctors said it did not appear to be a serious injury.
Left back Bastos opened the scoring with a powerful free kick in the 41st minute.
"It was a sensational feeling," he said. "I was able to take advantage of the chance I had. The World Cup starts today for me."
Winger Robinho scored from inside the penalty area in the 44th and midfielder Elano wrapped things up from close range in the 56th.
It was Brazil's first warmup since arriving in Africa to begin its World Cup preparations. It will face Tanzania in Dar es Salaam on Sunday in its final match before opening against North Korea in Johannesburg on June 15.
Brazil made too many early passing errors and encountered problems at the back against 110th-ranked Zimbabwe, which will not play in the World Cup.
The African side had two great chances to open the scoring as President Robert Mugabe watched from the stands. Ovidy Karuru missed an open goal in the 19th by shooting over the crossbar, and Knowledge Musona's header in the 27th was kept out by goalkeeper Heurelho Gomes, who had come on for Cesar.
Brazil began with most of the players expected to be in its starting lineup, with the exception of Thiago Silva, who replaced Juan in central defense. Juan was not fully fit and was rested by the Brazilians.
Brazil hadn't played since its exhibition win against Ireland in March. It was its first match against Zimbabwe.