The man held the captive, a receptionist, in a mailroom outside the governor's mansion and had been demanding to talk with Gov. Sila Calderon.
Once Calderon entered the room with police, who were holding metal shields to protect her, a police negotiator read aloud a letter the assailant had brought demanding a house and a job.
As soon as that was done, Roberto Figueroa put down the foot-long kitchen knife and was arrested, police Col. Jose Caldero said.
People in the street applauded when Calderon emerged with receptionist Iris Nereida Marcillio, who appeared unhurt. It was unclear what, if anything, the governor had Figueroa.
The governor entered the building housing the mailroom despite the advice of police, who had said it could be dangerous.
The man had refused to talk to negotiators, demanding to talk only to the governor, said chief-of-staff Cesar Miranda.
He took receptionist Iris Nereida Marcillio hostage in a building located about 150 yards from the main entrance of the La Foraleza mansion in Old San Juan, a historic district of the U.S. territory's capital.
The incident began about 9:30 a.m. and the governor entered the building about noon.
The man had lost a government job in the northern town of Manati and had made contact several times with the governor's office to demand help, most recently on Wednesday, officials said.
By Ricardo Zuniga