The world number six survived an early scare and is now the only seed remaining in the ATP 250 clay-court competition after Milos Raonic and Marcel Granollers both crashed out in Oeiras.
Mayer - ranked 82 places below Czech Berdych - fell behind early on, losing his opening service game, but claimed the last four games of the opening set to give himself an unlikely lead.
The second set continued in the same vein, with Berdych dropping his opening service game, but the top seed battled back with two breaks of his own to level the match.
Berdych found himself 4-3 and a break down in the decider, but recovered to win the final four games and seal an unconvincing victory.
His last-four opponent will be Romania's Victor Hanescu, who disposed of home favourite Gastao Elias with a 6-1 7-5 win.
After winning the opening set with ease, Hanescu let a 5-1 lead slip in the second before recovering to see out the match.
The other half of the draw saw both the second and third seeds eliminated from the competition.
Qualifier Daniel Gimeno-Traver cruised to a 6-1 6-2 victory over compatriot Granollers to set up a semi-final clash with Carlos Berlocq, who will be aiming to maintain Argentina's proud tradition in this competition after sealing a 7-5 6-4 win against Raonic.
Six of the past 12 stagings of this competition have been won by Argentinians, with Berlocq looking to join David Nalbandian, Juan Ignacio Chela, Gaston Gaudio and Juan Martin Del Potro in having triumphed in Portugal.