Get a scrap of roughly ¼-inch-thick wood or a thin piece of plywood, underlayment, or even engineered hardwood flooring big enough to distribute the blow over a larger area.
Into this piece of scrap, drill a hole slightly larger than the head of the nails. Next, start the nail, place the plywood shield over it, and firmly hammer it into place.
Remove the shield for a final, lighter tap that won't harm the surface. You can opt for a larger DIY shield or even create a small notch next to the nail hole to hold up the nail.
You can also center the nail hole along one side, near the shield’s edge, or drill the hole near a corner of the shield, depending upon the degree of protection you desire.