Valentino Rossi came within one turn of claiming a shock podium on his early return to MotoGP action, just six weeks after breaking his right leg.

The reigning seven time world champion snatched third place from Casey Stoner on lap 13 of a restarted, and shortened, 21 lap German MotoGP - triggering a thrilling battle that went to the last corner.

"Valentino was taking big chunks of time out of me and to be honest once he got past I didn't think I'd be able to follow," said Stoner. "I tried really hard to stay in there and we had a good battle with a lot of nice passes."

Rossi was back in third on the last lap and put his Fiat Yamaha into a defensive tight line for the penultimate left hand turn, one of the favoured passing points.

But Stoner stayed wide, giving him a stronger exit and propelling him alongside Rossi into the braking area for the final turn, where he sprung a surprise move on the inside of the Italian.

Stoner admitted there had been a little contact, but it was basically a classic block pass.

"I tried one last time at the bottom of the hill, where he tried to close the line on me but I was already there," said Stoner. "We touched but it was a good, clean fight and I'm just pleased to come away with a podium."

Rossi, who has inflicted far harsher passes, certainly wasn't unhappy with the move and declared he'd had so much fun racing with Stoner that he forgot about the pain from his leg and shoulder injuries.

"I didn't expect this! I thought it was maybe possible to make fourth or fifth place but I thought it would be very difficult. In the end I was fourth but I had a great battle with Casey and I was so close to the podium, so this is a fantastic result after missing four races," said Rossi.

"I felt a bit of pain in my shoulder but more in the leg when changing direction, but at the end the battle with Casey was such fun that I didn't think about it. Unfortunately though he just got the better of me on the last corner!

"Thanks to all my team for helping me come back and be competitive like this, we will try to do even better in Laguna," he added.

"We would have been happy whatever with a top five today, but finally we were really competitive and so close to the podium," said team manager Davide Brivio. "It's unbelievable and even more so because we were lapping at the same pace as the leaders. We've never been so excited by a battle for third position!"

Rossi has moved up to sixth in the championship, but has dropped to 111 points behind team-mate and title leader Jorge Lorenzo, who finished second to Dani Pedrosa on Sunday.