Cottrell Broadnax, an Oakland resident, was arrested on suspicion of carjacking, false imprisonment and possessing a firearm as an ex-felon, Oakland police Officer Jeff Thomason said.
Officers quickly responded to the hospital at about 3:30 a.m., and Broadnax surrendered after police formed a perimeter of patrol rifle officers, Oakland police Officer Holly Joshi said.
There were no injuries, she said.
Broadnax also reportedly jumped on the hood of a woman's car at a nearby gas station just prior to the hospital incident, Thomason said.
At 3:13 a.m., police received a report about a man who jumped on the hood of the woman's car at a gas station at the intersection of 47th Street and Martin Luther King Jr. Way, Thomason said.
The woman called police, and before officers arrived, Broadnax fled on foot and ran into the hospital minutes later, according to Thomason.