Sheriff's deputies were able to get the man to come down voluntarily around 2:25 p.m., according to Santa Clara County sheriff's Sgt. Jose Cardoza.
The incident began shortly after 10 a.m. when the man, who is in his mid 20s, approached a VTA bus that had stopped at the corner of First and Keyes streets, Cardoza said.
The man allegedly banged on the closed door of the bus and said something to the driver before climbing on top of the vehicle.
Cardoza said deputies initially believed the man had a screwdriver in his hand when they saw him, but it later turned out to be a pen.
Cardoza said although it had taken hours to resolve the standoff, it ended well.
"He wasn't a threat," he said. "It took him a couple of hours to come down voluntarily but we had a good result overall."
About a dozen deputies were on the scene, including some who are specially trained to work with people who have mental health issues, Cardoza said.
Cardoza said that it was unclear if the man would be booked into jail. At worst, he said, the man may be charged with a misdemeanor for resisting arrest.
Though the standoff occurred in San Jose, the sheriff's office handled the incident because they are responsible for law enforcement on VTA buses, according to Cardoza.