The reigning NBA MVP had 50 points, 11 assists and 10 rebounds in the 126-111 win on Thursday at Toyota Center in Houston.
His dunk came with 9:10 remaining in the first quarter. Harden faced up with Lakers guard Lonzo Ball at the 3-point line before blazing by Ball's left hip and dashing into the paint.
He then elevated over the 7-foot McGee, smashing in a powerful dunk with his left hand and forcing the Lakers center to the floor. Harden then flexed for a celebration. That shot gave the Lakers a 10-6 advantage.
Harden's dramatic 3-pointer came with 3:14 remaining in regulation. He dribbled up to the 3-point line while James was defending. Harden stepped into James as he launched a very deep shot, he fell to the ground as the ball flew through the air before rolling around the rim and falling into the net. The shot gave the Rockets a 118-106 advantage.
LeBron James led the Lakers with 29 points in the loss. Kyle Kuzma netted 24 points for Los Angeles.
"Good game," Harden told reporters when asked for his thoughts on the 50-point triple-double.
"Now we've gotta move on to Memphis, which is going to be a tough opponent. They're playing well right now as well."
Harden leads the league with a career-best 30.8 points per game this season. The Rockets face the Memphis Grizzlies at 8 p.m. on Saturday at FedExForum in Memphis. The Lakers face the Charlotte Hornets at 7 p.m. on Saturday at Spectrum Center in Charlotte, N.C.