Justice Minister Christine Lambrecht said secretly taking pictures up women's skirts was “a humiliating, unjustifiable violation of their private space”.
The cabinet also agreed to outlaw taking pictures of dead people that can be considered degrading, such as victims of traffic accidents, and spreading them online, government spokesman Steffen Seibert told reporters.
The legislation will now go before parliament.
Under current German law, upskirting can only be classified as a crime if there is physical contact or accompanying verbal insults.
But the new law could impose prison sentences of up to two years for taking the stealth photographs – for example, under escalators or stairwells.
Britain outlawed the practice in January.
In August, French lawmakers also passed a new law against sexist violence,
The French law also imposes on-the-spot fines for catcalling, comments on a
woman's looks or clothing, intrusive questions and unwanted following.