Gates revealed on Tuesday that the two men met secretly inside a fire station at Washington's National Airport on November 10 after Obama had visited President George W. Bush.
"We met when he went back to the airport," Gates told reporters. "We actually met in the fire station at National Airport and they pulled the trucks out so that our cars could go in."
Gates was a career CIA officer who rose through the ranks to become the agency's director in the early 1990s.
Although he was an analyst rather than an agent, Gates was familiar with the work of clandestine operatives. He did not reveal whether the fire station meeting was inspired by them.
During Obama's visit to Washington in the week after he won the November 4 presidential election, journalists reported he had gone into the fire station for a meeting but could not discover the identity of the other participant.
Only last week did news leak out that Obama would retain Gates as defense secretary, proving both men and their aides have something else in common with the best spies -- the ability to keep a secret