The two are said to respect each other’s abilities, and they share a similar hyperkinetic energy and an approach to global problem solving.

Their relationship became somewhat icy in 2007, friends of both say, when Mr. Bloomberg contemplated running for president as an independent at a time when Mrs. Clinton appeared poised to capture the Democratic nomination. But after she lost to Senator Barack Obama, and Senator John McCain of Arizona captured the Republican nomination, Mr. Bloomberg saw less of an opening for a third-party, centrist candidate.

Mr. Bloomberg delivered a powerful but late endorsement of Mr. Obama in his 2012 re-election campaign. He has not jumped on the early bandwagon to support Mrs. Clinton’s likely 2016 presidential campaign. Mr. Bloomberg is close to other potential 2016 hopefuls, including Vice President Joseph R. Biden Jr. and former Gov. Jeb Bush of Florida, who sits on the board of Bloomberg Philanthropies.

The event on Monday highlighted a joint effort called Data2X, involving Mrs. Clinton and the United Nations Foundation, that seeks to measure and track gender equality. Mr. Bloomberg praised Mrs. Clinton, at times expressing a giddy, self-effacing enthusiasm about their relationship.

“If my mother and father knew I was on a first-name basis with Hillary Clinton, it would be a very big deal,” he said.

Mr. Bloomberg said he had an excellent relationship with Mrs. Clinton when he was in City Hall and she was a senator. At one point, he recalled, Mrs. Clinton was adamant that the State Department “defray the cost of providing security to the U.N.” in New York.

But he joked that she had flip-flopped: “Do I have to explain to you what happened when she became secretary of state?”