San Jose made a bright start when Chris Wondolowski turned in a set piece delivery from Shea Salinas in just the seventh minute, but Real Salt Lake answered five minutes later through Kyle Beckerman's superb shot from distance that struck the inside of the post on its way into the back of the net.
The Claret and Cobalt enjoyed the better of play for the remainder of the first half, scoring twice more before the halftime interval.
Joao Plata handed Salt Lake the lead in the 32nd minute when he juked past a pair of 'Quakes defenders before lashing a shot past Jon Busch. And just when it appeared as though San Jose would make it to halftime with a one-goal deficit, Luke Mulholland pounced on a save from Busch in the fourth minute of stoppage time to stuff home the rebound.
The Earthquakes, who have made a habit of staging late comebacks in recent seasons, applied a great deal of pressure on Nick Rimando in the second period. They managed to get back to within one in the 75th minute when Bernardez met a corner kick from Salinas and sent a glancing header into the back of the net.
That goal galvanized San Jose for the remainder of the match as the 'Quakes heaped even more pressure on Rimando. They got their just reward in the final minute of stoppage time when the Salt Lake goalkeeper approached a cross but failed to punch it clear, allowing Bernardez to fire home a last-gasp winner.