Hudson retired the last 14 batters he faced and struck out five.
The Dodgers scored in the first inning off Hudson on a one-out walk to Mark Ellis and an RBI double by James Loney.
But Arizona came back with three runs in the second inning. Paul Goldschmidt singled and Ryan Budde lined a home run to left. McDonald singled, was bunted to second by Hudson and scored on Ryan Roberts' double.
The D-backs added to their lead in the third on a two-out, wind-blown home run by Chris Young and scored another run in the fifth off Minor Leaguer Allen Webster on a walk to Aaron Hill and a catchable but wind-blown triple to center field by Justin Upton.
Long after the regulars were removed from the game, the Dodgers added a run in the ninth inning on an RBI single from Tim Federowicz that scored Casio Grider.
D-backs up next: Patrick Corbin, Wade Miley and David Hernandez will get the ball against the Cubs in the D-backs' final game of the spring at Salt River Fields. They head to Chase Field for a pair of exhibition games against Milwaukee on Tuesday and Wednesday. Corbin has been very sharp this spring, allowing just one earned run in 15 innings. He has started twice and appeared in five games.
Ken Gurnick is a reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.