Mohammad Hafeez has two people to thank for his unlikely century against Australia just a month after he’d considered retirement: his wife, Nazia, and legendary Pakistan paceman Shoaib Akhtar.

A week after missing selection from Pakistan's 17-player squad for the two-Test series in the UAE, Hafeez marked his return from a two-year absence by posting a dominant 126, his 10th Test hundred and first against Australia.

The 37-year-old was a late addition to the squad and after slotting straight into an opening spot against the Aussies in Dubai, he combined with Imam-ul-Haq for the largest first-innings opening partnership Australia have conceded in over 30 years.

Hafeez, who was also left out of Pakistan's squad for the recent Asia Cup, admitted his recent omissions had weighed heavily on him.

"I had few problems in the last few months. I could have taken some steps, drastic (ones) but I was stopped from taking them," Hafeez explained after Pakistan reached 3-255 at stumps on day one.

"I could have taken them, my wife stopped me from that. Shoaib Akhtar specially called me and at that time I was thinking of drastic steps as I was very disturbed.

"I think Allah is the best planner and he planned good things for me.

"I could have been something else this time. I probably think this is the place where I had to stage a comeback.

"When I came back in the team all the players welcomed me and gave me confidence, welcomed me and that increased my inner energy. I am very happy at the comeback."

Akhtar, the former speedster recognised as one of the fastest bowlers in the game's history and who played 43 games alongside Hafeez before retiring in 2011, said he was delighted his ex-teammate took his advice.

"Hafeez wanted to retire and (was) about to give up from the international cricket," Akhtar tweeted.

"I told him to stick around for a little while and thank GOD he listened to me and now see him performing like this gives me great pleasure. (He) saved the day for Pakistan."

While Hafeez’s Test numbers make for good reading – his batting average ticked over 40 with Sunday's knock while his off-spinners have yielded 52 wickets at 34 – Hafeez's 51-Test career has been anything but smooth.

The allrounder has been dropped from national teams on multiple occasions while he's been banned from bowling for a suspect action three times in recent years, having made his most recent bowling comeback earlier this year.

Despite the setbacks, Hafeez barged the door down at domestic level to get another opportunity at Test level, blasting a double-ton and taking a six-wicket haul in the opening few weeks of Pakistani season.

Having seen how the likes of recently-retired former skipper Younis Khan handled the constant pressure of being an icon for a passionate cricketing nation, Hafeez hopes to savour the final chapter of his international career.

"Look, Younis Khan had to prove himself even in his last Test, so it happens with us (too)," a smiling Hafeez said.

"It's like this and it's tough to understand yourself that how many times you have to prove yourself.

"You are challenged by that, your critics challenge you and they wait for your bad performances and highlight them. That challenges you and it brings the best out of you.

"Whoever is the player is, he wants to leave with respect and that is my wish.

"I want to play with respect. There are other avenues after that but whatever life is left in me I want to play for Pakistan and leave on a high."