It was the fifth win in the last six games for the Red Bulls (7-4-3).
With the game in stoppage time, Juninho made a free kick pass in front, where Cahill rose above the defenders to head home the game winner.
The game appeared headed to a scoreless tie, until Cahill broke the deadlock with his goal, his fourth of the season – all coming within the last five games.
Luis Robles made three saves to record his fourth shutout of the season.
In the 76th minute, the Galaxy (5-4-2) had two great chances, both from Gyasi Zardes. On the first attempt, Red Bulls defender Jamison Olave, who had a brilliant all-around game, made a sliding tackle to knock the ball away. Two minutes later, Zardes fired a right-footed blast from 10 yards out that Robles punched aside.
The Galaxy had another great chance, when Zardes’ crossing pass went directly to Keane’s head, who directed it just wide left of the goal in the 89th minute.
The Red Bulls had two decent opportunities in the early portion of the second half, when Fabian Espindola and Cahill both fired long shots that sailed wide left within four minutes of each other.
Espindola had yet another great chance, but his left-footed shot from 35 yards out bounced once into the arms of goalkeeper Carlo Cudicini.
The Galaxy then dominated play for the next 10 minutes.
Landon Donovan fired a right-footed blast from 19 yards out that sailed over the crossbar in the 61st minute.
The first half was played in a steady rain and featured few scoring chances.
The Red Bulls had the better of the opportunities, both created by Espindola.
In the 27th minute, Espindola perfectly split two defenders to get a clear path to the goal. He went right in on Cudicini and drew the goalie away from the box. But Espindola’s soft shot was eventually kicked aside by Galaxy defender A.J. DeLaGarza before it reached the goal line.
Five minutes later, Espindola unleashed a left-footed blast that Cudicini corralled.
The Galaxy had their best chances in the final minute and added time. In the 44th minute, Robbie Keane was brought down from 30 yards out, awarding Los Angeles a direct free kick. Keane took the free kick and the bending high shot was punched aside by Robles.
Two minutes later, Todd Dunivant took a left-footed shot from 10 yards out that Robles secured, keeping the scoreless tie into intermission.