Two quick-thinking cops assigned to Mayor de Blasio’s security detail at Gracie Mansion arrested a man wanted for randomly attacking an 85-year-old in the area four days earlier, police said.

Det. Robert Carter and Police Officer David Barker were on their break and taking a jog along the FDR about 8:30 a.m. Sunday morning when they spotted a man who looked like the suspect wanted for sucker-punching the senior.

“Thank you Det. Carter & Ofc. Barker. Exceptional work,” the mayor tweeted Sunday afternoon. “Identified and arrested man wanting for assaulting a senior – all on their meal break!”

The officers, assigned to INTEL-MSS were in plain clothes when they saw Edwin Suazo, 35, hanging around E. 90th Street and the FDR Drive footpath.

“The officers quickly retrieved the wanted poster from inside the Gracie Mansion security booth to properly match the description,” the NYPD said in a statement.

Added a source: “They stopped and questioned him. They took him into custody without incident.”

Surveillance video of the attack shows a man in jeans, a puffy black jacket and burgundy beanie approaching the victim inside Carl Schurz Park on E. 90th St and East End Avenue last Tuesday afternoon.

Seemingly out of nowhere, the suspect was seen smashing the old man in the back of the head with a gloved, closed fist.

After the elderly man was knocked down, the suspect continued to hold out his fist as an angry scowl played on his face.

The victim told a local NBC reporter that he blacked out after the punch and when he opened his eyes, he was on the ground with his attacker standing over him.

The senior, who said he lives in the area and walks daily through the park, said his attacker made eye contact with him, but never said a word.

The man said the attacker walked backwards away from him, before finally turning and running away.

Police said the victim was treated for cuts to the back of his head and over his right eye, police said. Suazo was taken to the 19th Precinct and charged with assault.