Bernardez lined up for a free kick in the 94th minute and grounded a shot that got through the Galaxy's defensive wall and reached goalkeeper Josh Saunders, who bobbled it before letting it sneak past him into the net.
Jon Busch made two saves for the Earthquakes, who will seek to close out their Western Conference series when the scene shifts to San Jose for Wednesday's second leg.
The closest the Galaxy came to scoring was when Robbie Keane blasted a shot off the crossbar off a leave from Landon Donovan in the 86th minute.
Senate Democrats to pull all-nighter on climate change
Interpol investigating stolen passports on missing flight