Fellow officers had to use a taser to bring the suspect under control after police said he was spotted waving the weapon.
The man and the policeman, who sustained injuries to one of his shoulders, were taken to hospital.
The incident happened at around 5.15pm on The Mound as office workers headed home for the weekend and the area was busy with shoppers and tourists.
Police were on a routine patrol when they came across the man. Onlookers then watched in horror as the man appeared to wield a knife at the officer and a struggle took place.
Last night police said the suspect was being detained in police custody.
Princes Street was closed westbound after the incident, which happened in rush hour. Drivers faced delays due to the closure and the tram services were also disrupted, with the vehicles only travelling between the airport and Shandwick Place while the section of Princes Street remained cordoned off. Lothian Buses were being diverted via George Street and Frederick Street.
A Police Scotland spokesman said: "At around 5.15pm on Friday, July 4, armed response officers who were on routine patrol in the city centre observed a male in The Mound area whose behaviour gave them cause for concern.
"After being approached, the male became aggressive and presented a knife before struggling with police.
"Taser was deployed to bring the male under control before he was taken to the ERI for assessment where he is detained in police custody.
"One officer sustained an injury to his shoulder during the incident and has also been taken to hospital for treatment."