Magee scored in the 62nd minute and Gonzalez helped solidify the defense to lift the short-handed Galaxy to a 1-0 victory over FC Dallas on Saturday night.
The defending MLS champion Galaxy (10-10-3), playing without stars Landon Donovan and David Beckham, extended their unbeaten streak to 4-0-1. Los Angeles has lost just twice in its past 10 matches (7-2-1).
"It was a good result for our team tonight," Galaxy coach Bruce Arena said. "We've played awfully well over the last month, so we're getting ourselves in good shape and making progress."
Los Angeles goalkeeper Josh Saunders needed to make just one save for his fourth shutout of the year.
"I thought that we had good shape the whole game," said Gonzalez, who was making just his third appearance of the season -- playing all 90 minutes for the first time -- after suffering a knee injury in January. "I thought that we actually put a lot of pressure on them and didn't really allow them to do much of anything."
Dallas (5-11-7) has split its past four games (2-2-0) since a franchise-record 13-game winless skid (0-7-6) dropped it to last in the Western Conference.
"Obviously the result is very frustrating for us," Dallas coach Schellas Hyndman said. "A great crowd, but they didn't let us play. Give them a lot of credit, they seemed to have outworked us, which was disappointing. I think it's the first time this year I've felt that we got outworked. At the end of the day, they just had way too much time, too much space and deserved a win."
Donovan sat out after he was suspended for the first time in his MLS career for yellow card accumulation, while Beckham had not rejoined the team after participating in the opening ceremonies at the London Olympics on Friday night.
"Those are some big shoes to fill, with those two missing, so obviously to get a result with those two gone is huge," said Magee, who had missed the previous four games with a right shin hematoma. "But we all know collectively we need to step up and fill those roles."
Dallas was also missing its best player, as Brek Shea sat out for the second consecutive contest after arguing with Hyndman when he was substituted out of a 2-1 loss at San Jose on July 18.
Shea, who scored 11 goals and was a finalist for MLS MVP last season but has just three in 14 games this year, did return to practice this week, but was once again left off the roster for the game.
"The decision is no different than the decision that we made a week ago," Hyndman said. "We feel that at this point in time, the best thing we can do for Brek is to give him a chance to kind of remove himself from the pressures and the demands and kind of figure things out a little bit better."
Magee struck for his fourth of the season just moments after a chance from Dallas' Scott Sealy was denied by Saunders. After receiving a pass from the left side by Robbie Keane, Magee boomed a shot from the top of the penalty area just inside the left post, past diving Dallas goalkeeper Kevin Hartman.
"Robbie laid it in to me and I was trying to get it back to him, but I think like three defenders went with him, so I took my shot," Magee said of the play. "We created enough chances tonight to maybe get two or three goals, but fortunately, we only needed one."
The best opportunity for Dallas to draw even came in the 82nd minute when a cross from Fabian Castillo found Jackson for a point-blank 8-yard header, but it bounced just wide of the left post.
It seemed like the biggest obstacle of the night for the Galaxy was the heat, with the game-time temperature announced as 102 degrees.
"We survived, that's all you can do," Arena said. "It's very difficult playing in these conditions and our guys hung in there, they were pretty efficient the way they played. They handled the heat pretty well."
The contest also marked the first time Dallas wore its new jerseys, with the logo of their new sponsor AdvoCare prominently displayed on their chests.