The Germans, who play Armenia on June 6 in their final warm-up, looked still some way off top form as they seek to end an 18-year title drought, missing several key players including captain Philipp Lahm and first-choice keeper Manuel.
Germany coach Joachim Loew must name his final 23-man squad by Monday's deadline.
Loew's side almost got off to a perfect start when Mesut Ozil, completely unmarked in front of goal, somehow managed to shoot wide seconds after the kickoff.
The Germans, drawn with Ghana, the United States and Portugal in Group G, came close again as attacking midfielder Mario Goetze, playing as a lone striker, sent in a low drive which was turned on to the post by Cameroon keeper Charles Itandje.
Cameroon, playing hosts Brazil, Croatia and Mexico in Group A, had trouble containing their opponents' pace down the wings and needed to wait around 20 minutes before Samuel Eto'o got a shot on target.
A series of tough tackles from the Africans threw the hosts off balance and gave the visitors the initiative.
German keeper Roman Weidenfeller was called into action late in the first half, making a superb save in the 39th minute when Eto'o sent Benjamin Moukandjo clear and he also blocked a close-range Joel Matip effort.
Cameroon stunned the Germans in the 62nd minute when Eto'o's shot was saved by Weidenfeller but the forward was in the right place to tap in a subsequent cross.
Their joy was short-lived, however, with Thomas Mueller charging into the box to head in a Jerome Boateng cross four minutes later and Andre Schuerrle tapping in after a surging run by substitute Lukas Podolski.
But Cameroon refused to lie down and Eric-Maxim Choupo-Moting confirmed his outstanding form this season with Mainz 05, picking up the ball outside the box and drilling an unstoppable left-foot shot past Weidenfeller in the 78th minute.