The suspect, identified as Arturo Corona, 32, became stuck in an 18-inch space between the buildings after allegedly fleeing the scene of a crash after a high-speed chase, the San Jose Mercury News reported.
It took firefighters about 90 minutes to pull Corona out of the space using ladders and ropes.
Corona, wearing only a trash bag when firefighters found him, likely either jumped or fell off one of the buildings and became stuck about 20 feet down, police said.
Corona told police he was being chased by two men brandishing knives before he became wedged between the buildings.
Police said Corona is suspected of leading California Highway Patrol on a high-speed chase on Highway 101 about 10 p.m. Wednesday after being spotted speeding, San Jose's KTVU-TV reported. At some point, the Honda Civic pulled off the highway, the chase was called off and police officers circulated the area searching for the vehicle.
The Honda was found after it was involved in a collision in which one person suffered non-life-threatening injuries and was taken to a hospital.
The driver of the Civic took off on foot.
Police said Corona is listed as the owner of the car involved in the collision and it fits the description of the car involved in the chase.
"He was most likely involved in the pursuit with the CHP," said San Jose police Lt. Mike Sullivan. "We feel very strongly he was involved in the pursuit."
Corona will be charged with suspicion of felony hit and run and driving on a suspended license, Sullivan said.
'How to Train Your Dragon 2' releases 5-minute clip
Lytro unveils camera that can focus a photo after shooting it