Gallardo (5-6) scattered four hits while issuing just one walk and striking out four in the performance, during which he tossed 68-of-108 pitches for strikes.
The right-hander fanned Marcell Ozuna in the fourth inning for his 1,000th career strikeout.
Lucroy went 4-for-5 with a pair of run-scoring singles and Carlos Gomez also drove in two runs while banging out three hits as the Brewers took the opener of a three-game series with a fourth consecutive win overall.
Marlins starter Ricky Nolasco (3-7) yielded four runs on 10 hits over 5 1/3 innings.
Ed Lucas got the only RBI for Miami.