Mike Magee put Los Angeles in front 2-0 in the 73rd minute, but the Galaxy collapsed down the stretch to extend their winless streak to six games.
Steven Lenhart began the San Jose comeback by scoring on a header off a corner kick in the 76th minute.
David Beckman was then called for a hand ball in the box, setting up Khari Stephenson for a successful penalty kick that tied it in the 81st minute.
Gordon drove his header into the top left corner of the net in the 4th minute of extra time, to move the Earthquakes (8-1-3) into first place in the Western Conference. San Jose leads Real Salt Lake by a point.
Los Angeles remained stuck in last place in the conference with a 3-7-2 record.
Notable deaths of 2014 [PHOTOS]