Michael Soutar, 26, was being sought in connection with the fatal shooting of Ezekiel Taylor on April 20.
Taylor, also 26, was shot shortly before 10 p.m. that day in the driveway of a home on Franklin Avenue between Culp Avenue and Harder Road, police said.
He died the next morning at Eden Medical Center in Castro Valley.
Two days after the shooting, police announced that they had obtained a warrant for Soutar's arrest, but he remained at large until this morning.
Hayward police Lt. Eric Krimm said investigators had been conducting surveillance on Soutar and took him into custody at about 12:15 a.m. today in the parking lot of the Walmart at Hesperian and Lewelling boulevards.
"We were lucky enough to catch him," Krimm said.
Soutar had a handgun in his possession, but he was arrested without incident, Krimm said.
When police announced in April that they were looking for Soutar, they described him as 5 feet 9 inches tall and 175 pounds, with long brown hair and brown eyes. They said he has tattoos of the word "East" on his right wrist and "Bay" on his left wrist.
Krimm said Soutar is also wanted by the Alameda County sheriff's office for a recent shooting in that agency's jurisdiction.