Looking at your comments, you're interested in the concept of employment verification in the US.
In the US W2s are not issued by the government, but rather by your employer (through their payroll provider), and are not public but are only known to the employer, you, and the IRS.
For a third party to verify the correctness of the W2 you provide to them, they'd need a confirmation from either of the other two parties. The IRS can provide such a confirmation if you agree to provide a signed form 4506 (or 4506-T) to the third party. Sometimes the third party may just ask you to just provide them a copy of your tax return or the IRS transcript directly (forging either is a felony).
Alternatively the third party can contact your employer. For that they can either call the HR department directly or use another intermediary to which employers report information, if your employer participates. For example, Equifax has such a service. Your permission would be required, and is usually granted via a code for such an intermediary, or an HR letter that you yourself request from your HR to provide to the third party, on which the information is provided. The third party then calls the HR to verify the letter. The HR in the US will not confirm your salary without your prior permission, but they will be able to confirm the fact of your being employed without your permission or even knowledge.
Another way to confirm your information is through credit reports, however these don't usually include your salary and may not always include your correct or up to date employer.
If you're in the US and you're applying for a visa or a mortgage, you'll usually be required to provide an employment verification letter (that HR letter I mentioned earlier) and the consulate or lender will call the HR department to verify it's authenticity. And yes, they do call.