An intense manhunt was conducted following the incident, which began at a Chevron at the intersection of Ranchero Road and Escondido Avenue, according to investigators. The deputy confronted a robbery suspect at the gas station and tried to pepper-spray the man, who then brandished a gun and opened fire, the sheriff's department said.
The deputy's life was saved by his bulletproof vest when he was struck at least once, authorities said. His vehicle was later seen with what appeared to be two gunshot holes in its windshield.
The deputy returned fire and pursued the suspect, who escaped.
News video showed the deputy rubbing the part of his torso where he apparently had been struck. He was transported to a hospital with injuries that were not life-threatening, authorities said.
The San Bernardino County Sheriff's Department initially released a surveillance photo of the man being sought and his vehicle. One photo showed him wearing a collared shirt and dark sport coat inside the gas station's convenience store.
Shortly before noon, the department announced on twitter that the suspect had been taken into custody. No other details about the arrest were immediately available.