The Warriors outscored the Magic 37-27 in the fourth quarter to claim just their third road win of the season. Davis scored 13 in the period and finished the game with nine assists.
"We've been preaching in road games to stay close and allow our style of play to take over at the end," said Davis, who is averaging 27.8 points and 8.9 assists in his last five games. "We were poised all night."
"We didn't have an answer for Baron tonight," Magic coach Brian Hill said. "We tried playing him straight up, we tried switching on him, it really didn't matter what we did, he beat everything we threw at him."
Davis converted a fastbreak layup to give Golden State a 100-93 lead with 5:07 left, but it was Dunleavy's two 3-pointers in the final 1:52 that secured the win.
The first was more of a wild throw just to beat the 24-second shot clock, which expired just as the ball went through the net. It put Golden State ahead 107-100 and took the fight out of the Magic.
"That was a lucky shot, but the other ones were right on," Warriors coach Don Nelson said. "The 3-pointers actually won the game for us. We made some, they didn't. Otherwise it was a pretty even game."
The second came with 51 seconds left and gave Golden State a 112-104 cushion.
Neither team could find a rhythm offensively in the first half. Ariza had 13 points and Hill 10 as the Magic built a 52-48 at halftime, despite shooting only 41 percent and committing 11 turnovers.
The Warriors weren't much better, hitting only 42 percent and turning the ball over nine times. Davis scored 15 and Dunleavy 10 to keep Golden State close.
The Warriors finally got it going in the second half, taking advantage of their superior size and speed in the backcourt. Davis had two of his team's five three-point plays in the third quarter as Golden State built a 75-68 lead.
The Magic rallied to take an 81-80 advantage at the end of the quarter, but Golden State started the fourth quarter with 3-pointers from Matt Barnes and Dunleavy, a reserve, to regain control.
Magic PG Jameer Nelson returned to the lineup after missing four games with a strained groin. ... The Magic had not scored more than 89 points in their last eight games. ... Pietrus has scored in double figures a career-high 10 straight games. ... Golden State's reserves outscored the Magic bench 47-25. ... Orlando's Dwight Howard tied a season high with five blocked shots.