Gray spent seven weeks laid up, having torn his hamstring in Scotland's 28-18 defeat to Wales in the Six Nations.
But he returned to fitness ahead of schedule thanks to a gruelling training program, which included numerous sessions on an Olympic rowing machine.
"There's a two kilometre challenge on the rowing machine to go sub-six minutes and I did it," said Gray.
"I've been through the mill. There have been a lot of rowing sessions involved in my recovery and it's been enjoyable.
"I've been giving it big licks and the times on the machine were the fastest I've ever set. However, it was my goal over six weeks to get myself fit enough to throw my name in the ring for the Lions."
And the Scotland giant was thrilled that the hard work paid off after suffering the tour threatening injury.
He will now battle Alun Wyn Jones, Geoff Parling, Ian Evans and Paul O'Connell for a spot in the second-row boiler house.
"I'm absolutely delighted," said Gray
"I watched the squad announcement at home in Glasgow and didn't particularly want to look at the telly. My old man forced me. It seemed to take a long time before my name was announced.
"It has been an anxious couple of weeks. The Lions weren't even on my mind when I was carried off against Wales, I was just gutted to be out of the game.
"I didn't even know the extent of the damage I had suffered but I'm glad I made it in the end."