Deputies shot and killed an armed carjacking suspect after an intense chase and shootout early Tuesday in San Leandro, officials said.

The suspect, who was wanted in connection with a drive-by shooting Monday night in Oakland, was shot multiple times after exchanging gunfire with deputies in an alleyway near Interstate 238, said Sgt. J.D. Nelson with the Alameda County Sheriff’s Office.

“To me it feels like the suspect was playing a real-life game of ‘Grand Theft Auto,’” Nelson said. “But, ultimately, this is not a game. This is real life and these are real bullets.”

Around 2:20 a.m., Oakland police tried to stop a black Dodge Durango matching the description of a vehicle spotted fleeing an East Oakland drive-by shooting that occurred around 9 p.m. and left a man hospitalized with non-life-threatening injuries, officials said.

The driver of the Durango refused to pull over, prompting a chase along Interstate 580 near 150th Avenue, police said.

The driver briefly ditched officers. Police later found the sport utility vehicle abandoned and facing the wrong direction in westbound lanes of I-580 near 164th Avenue, Nelson said. Within moments, a man wearing a red hoodie and armed with a handgun tried to carjack a motorist two blocks from where the Durango was discovered.

When the carjacking attempt failed, the assailant started running along I-238, Nelson said. As California Highway Patrol officers began chasing him on foot, the suspect opened fire, hitting a passing car, officials said.

No one was injured in the shooting.

The suspect, described as being in his 30s, then ran off the interstate at East 14th Street with several Alameda County sheriff’s deputies running after him, Nelson said.

The man ran into an alleyway behind a sound wall near the freeway where a shootout erupted. Multiple deputies opened fire, killing the gunman, Nelson said.

No law enforcement officers were injured in the shooting.

“If you think about all the things that were involved — a person shot in a drive-by, a suspect firing at CHP officers — this had the potential for some very tragic results,” Nelson said.

Evan Sernoffsky is a San Francisco Chronicle staff writer. E-mail: esernoffsky@sfchronicle.com Twitter: @EvanSernoffsky