Afghan and Western officials on Sunday said NATO and Afghan forces came under fire from across the Pakistan border on Saturday before they called in a deadly airstrike on two Pakistani military posts, in an incident that has left U.S.-Pakistan relations in tatters.

Pakistan's military denied firing on North Atlantic Treaty Organization forces, calling the "unprovoked" raid on the border posts an "irresponsible act."

The...