The agreement follows claims and counter-claims by the two countries about harassment of each other's diplomats.
'India and Pakistan have mutually agreed to resolve matters related to the treatment of diplomats and diplomatic premises, in line with the 1992 'Code of Conduct' for treatment of Diplomatic/Consular personnel in India and Pakistan,' the Ministry of External Affairs said in a statement.
A similar statement was issued by Pakistan Foreign Office also.
The Code provides for 'smooth and unhindered functioning' of the diplomatic and consular officials of the two countries in conformity with the international laws without violating their privileges and immunities.
The Code also says that the two countries should not resort to intrusive and aggressive surveillance and actions such as verbal and physical harassment, disconnection of phone lines, etc.
Earlier this month, India had asked Pakistan to ensure safety and security of its officials working at the Indian mission in Islamabad, saying they continue to face 'harassment' and 'intimidation'.
In its 16th 'Note Verbale' to the Pakistan Foreign Ministry on March 22, the Indian High Commission specifically mentioned three incidents of harassment of senior officials.
Pakistan had claimed that there had been as many as 26 instances of harassment and intimidation of its diplomats since March 7, following which Islamabad called back its high commissioner Sohail Mahmood for discussions on the issue.
He, however, returned to New Delhi on March 22.
After Friday's announcement, Pakistan Foreign Office spokesman Mohammad Faisal in a brief statement said that the matter will be addressed under the mechanism of 1992 related to the treatment of diplomats.
It was not immediately known where and how the agreement was reached to sort out the current tension over diplomats.
Faisal had said yesterday at a press briefing that the two sides would address the issue of harassment of diplomats through talks.
Pakistan calls its envoy home; India terms it routine
We are close to war with Pakistan
Why India must worry about the Pakistan threat
How should India deal with Pakistan?
Can India fight China and Pakistan simultaneously?