The Giants have won five of six and have the best record in the NL at 37-20.
St. Louis has lost four of five. The Cardinals managed just four hits.
Hudson (6-2) gave up three hits, struck out six, and walked two in improving to 4-4 against St. Louis. Hudson's previous win against the Cardinals came on July 19, 2007, as a member of the Atlanta Braves. He retired the last 11 batters he faced.
Arias got the start after Michael Morse fouled a ball off his left foot in batting practice. In his second start in the last 24 games, Arias went 3 for 4 with three RBIs. He broke out of a 0-for-14 skid with a bases-loaded single in the first.
Buster Posey had three hits in returning to the lineup after missing three games with tightness in his lower back.
Lance Lynn (6-3) gave up seven runs, four earned, and eight hits in 3 1-3 innings after posting his first career shutout on Tuesday against the York Yankees.
Angel Pagan, Hunter Pence and Posey singled to start the four-run first. Posey's RBI hit came on Lynn's 10th pitch.
Gregor Blanco reached on an error by Kolten Wong and Pence scored on a groundout by Brandon Crawford. Brandon Hicks walked to set the stage for Arias' bases-loaded single.
Matt Carpenter extended his hitting streak to 14 games with a first-inning single. It is the longest current streak in the NL.
Notes: Former University of Missouri men's basketball coach Norm Stewart threw out the first pitch. ... The Giants finished May with an NL-best 19-9 record. ... St. Louis OF Matt Holliday walked in the third inning and has reached safely in all 28 home games.