Police closed the gate of of the Mountain View garage Tuesday evening, once they knew the lion was inside.
Sgt. Saul Jaeger said the 110-pound animal had been spotted on the street a short time before.
"It's kind of by luck that it went into an area that's kind of a large cage," said Jaeger.
Onlookers, many of them armed with cellphone cameras, were encouraged to leave. Several hours later, wardens used a tranquilizer gun to knock the lion out. Officials plan to release the large cat into the Santa Cruz Mountains.
Jaeger said the people who first saw the mountain lion did the right thing by dialing 911.
"Don't try to pet it," he said. "You're not a mountain lion whisperer. Let the professionals handle it."
According to police, previous reports of mountain lions on the outskirts of Mountain View-- best known as the headquarters of Google, Symantec and Intuit-- have proved to be large domestic cats.
The mountain lion was already fitted with a radio collar when it was found.