Putin said in the interview with the NTV channel that he had good memories of his 1985-1990 posting in the city that included learning German, excursions to the mountains and contacts with his East German counterparts.
"I still remember this warmth and cordiality," he said in the interview to mark the fall of the Berlin Wall two decades ago, excerpts of which were published by all Russia's main news agencies.
"I am very thankful for this. In this respect there is some feeling of nostalgia," Putin told the broadcaster.
"But we see how the Federal Republic (post-reunification Germany) is developing and we are happy that we have good relations on a new basis," he said, adding, "This of course makes any nostalgia secondary."
Opening up for the first time about his hitherto mysterious past in the intelligence service, Putin described his time in East Germany as "not the worst years of my life and I would even say good ones."
"We made friends with our colleagues, got to know a world that was new for us and I became familiar with the language and had contacts with people. Our children went to the German nursery school. We talked to our neighbours.
"This door into a completely different world was very interesting. We had many contacts not only with our colleagues from the Ministry for State Security (Stasi) but from other areas," he said, fondly recalling excursions to the mountains at Christmas.
Putin said he gave great weight to the importance of relations between Russia and Germany.
Despite the burden of World War II, Moscow enjoys better ties with Berlin than most other European states and they enjoy a key trade relationship.
"Whatever happens in Germany domestically there is a definite national consensus on the development of the relationship with Russia," said Putin.
He described former German Chancellor Gerhard Schröder as "my friend". But Putin said he also had "remarkable, very good personal and business relations" with his successor Angela Merkel even though she is from another party.
"There is an understanding that we need each other. And that is the main thing."
As president, Putin in 2005 described the collapse of the Soviet Union as the "greatest geopolitical catastrophe" of the 20th century, an opinion his successor Dmitry Medvedev declined to endorse in an interview with Der Spiegel magazine this weekend.