Anderson Julio also scored for Real Salt Lake, who overcame a 2-0 first-half deficit to avoid a costly setback.
The tie leaves Real Salt Lake (13-12-8, 47 points), one point behind the fourth-place Houston Dynamo in the competition for a top-four Western Conference playoff spot and homefield advantage in the first round. Salt Lake is tied with the Vancouver Whitecaps for the fifth-most points with one match remaining.
The Galaxy have allowed 24 goals over their past eight matches.
Los Angeles' 21-year-old Novak Micovic made his MLS debut in goal and had four saves.
Zac MacMath had five saves for Real Salt Lake.
Salt Lake had a 20-16 edge in shots but Los Angeles placed seven on target to RSL's six.
Los Angeles struck in the seventh minute on Joveljic's right-footed shot. It was his sixth goal of the season and was set up by Daniel Aguirre's pass.
Costa's goal made it 2-0 in the 34th minute. Joveljic sent a touch pass to Costa, who booted a left-footed shot into the right corner of the net for his third goal of the season.
Real Salt Lake got on the board in the first minute of first-half stoppage time. Julio's right-footed shot deflected off a Galaxy defender and found the back of the net. It was Julio's fifth goal of the season.
In the 76th minute, Luna sent a right-footer through traffic that tipped the hand of Micovic before ending up in the net. It was Luna's fourth goal of the season.
RSL had a solid chance in the 18th minute, but Andrew Brody sent a close-range right-footer off the crossbar.
RSL's Marcelo Silva had an opportunity to score off a corner kick in the 64th minute, but his header went over the net.
--Field Level Media