Minnesota (8-7-3, 27 points) came into the game in sixth place in the Western Conference, one point back of San Jose (7-7-4, 25 points) but now holds the two-point lead.
It was the first MLS loss for San Jose since May 11 as the Earthquakes had run off a 4-0-2 record since then to jump into the thick of the playoff race after starting the season 0-4-0.
Tied 1-1 at the break, Minnesota got the game winner in the 52nd minute off a Michael Boxall goal.
The big defender pushed up from the back, making a run into the attacking third. He tried to push a ball through to the right, but it deflected off a San Jose defender and right back towards Boxall, who never broke stride.
He got to the ball a step before San Jose goalie Daniel Vega and pushed it home for the lead.
San Jose controlled the game after that, but Minnesota iced it on a Kevin Molino goal two minutes into stoppage time.
Minnesota got on the board just five minutes into the game when Darwin Quintero put home a volley off a cross from Ethan Finlay.
Finlay got loose in the right side of the penalty box before sending the cross to Quintero. Vega did get a hand on the ball but was unable to keep it out of the goal.
The goal put to a rest a scoreless streak of 205 consecutive minutes for the San Jose defense.
San Jose tied it in stoppage time at the end of the first half when a Magnus Eriksson free kick from 20 yards out on the right side of the field was deflected off the stomach of Tommy Thompson and into the goal to make it 1-1 at the break.
Minnesota get past San Jose 3-1
Minnesota United gain some ground on their immediate western conference rivals in Seattle as they beat San Jose on a night the Sounders lose to NYCFC.
Darwin Quintero gives Minnesota early lead over San Jose
Major League Soccer: Darwin Quintero (5') Minnesota 1-0 San Jose