The Earthquakes improved to 13-4-4 and boosted their lead over Real Salt Lake at the top of the Western Conference to seven points.
San Jose came within minutes of recording its third straight shutout, but wound up almost giving away the win in the late going.
Chavez scored in the 12th minute and Gordon tallied just before the end of the opening half.
Dallas (4-10-7) had one victory and three draws in its previous four games.
Hernan Pertuz scored on a spectacular header in the 89th minute to bring Dallas within one and San Jose's Simon Dawkins was called for a foul in the penalty box against Zach Loyd during the third minute of stoppage time.
Jair Benitez, who has not scored during his MLS career, was chosen to take the penalty kick and he launched the ball over the crossbar to leave San Jose the winner.