Karzai telephoned Sharif this morning and felicitated him on assuming the office of the premier.
Sharif accepted Karzai's invitation to visit Afghanistan and thanked him, said a statement from the Pakistani Prime Minister's Office.
While talking to Sharif, Karzai "extended his best wishes and expressed the hope that both the brotherly countries will continue to work for further improvement in the bilateral relations which would augur well for peace and stability in the region" the statement said.
Sharif further said he was looking forward to visit Afghanistan.
Also Read
Karzai has also accused the Pakistani military of backing militants carrying out attacks in his country.
In a separate development, Iranian President Mahmoud Ahmadinejad also felicitated Sharif and the people of Pakistan on the successful completion of the general election and the victory of the PML-N.
In a message, Ahmadinejad expressed confidence that relations between the two countries would flourish under the leadership of Sharif.
The Speaker of Iran's Consultative Assembly, Ali Larijani, too sent a message congratulating Sharif.
Larijani hoped there would be increased parliamentary interaction between the two countries in the days ahead.