Kubica, who will be 34 next month, was announced at the Abu Dhabi Grand Prix on Thursday as a Williams driver for 2019.
The Pole last raced in Formula One in 2010, before he partially severed his right forearm in a near-fatal rally crash in Italy.
Season 2019
Ferrari secure Leclerc for the next five years
23/12/2019 AT 11:43
"Is Robert older than me?" was Hamilton's first question when asked for his reaction to the news.
"Oh, perfect," continued the 33-year-old Mercedes driver, whose birthday is in January, when that fact was confirmed by reporters.
I am so happy he's coming back. Fernando (Alonso) is leaving and I was going to be the second oldest driver but now I can remain the third. I can't tell you how happy I am about that.
Alonso, 37, is leaving after Sunday's' season-ender at Yas Marina with Finland's 2007 world champion Kimi Raikkonen the oldest man on the grid at 39.
On a more serious note, both Hamilton and Alonso welcomed Kubica's return as great news for the sport and for a man they both rated as one of the best from their previous battles.
"I raced him from karting days so I have known him for a long, long time," said Hamilton. "He was always one of the most talented drivers that I have had the pleasure of racing.
He's had a really difficult time for the last who knows how many years now and it's just great to see that he's got the opportunity back and I hope he works hard on his strength and getting his mind back into gear like he was in the past.
"I think it's exciting for the sport to see him back in action."
Two times champion Alonso, Hamilton's team mate at McLaren in 2007 and a long-term friend of Kubica who had been close to joining Ferrari before his 2011 accident, agreed the Pole was "one of the great talents".
"It remains to be seen what will be the performance of the car, and his own performance because we only saw a couple of tests but if he is 100 percent he will be amazing to watch," added the Spaniard.
Former world champions Williams will end the year in last place after wrestling with a poorly-handling car throughout the 2018 season.
Season 2019
Alonso to test for McLaren F1 team in ambassador role
27/02/2019 AT 11:23
Season 2019
Ferrari unveil new Formula One car for new era
15/02/2019 AT 12:02