If your dog is pierced by porcupine quills, you should take them to the vet immediately if you are able. Veterinarians can give the dog a sedative to make them more comfortable while the quills are being removed. Removing porcupine quills is quite painful.
If you cannot get to the vet in a timely manner and/or there are not many quills, you may remove them one at a time with needle nose pliers. With the pliers grab the base of the quill where it enters the skin and pull quickly straight out.
The image on the left above shows where to grasp the quills when they are removed. The image on the right shows the tip of a porcupine quill under a microscope. As you can see there the tip that enters the skin is the size of the tip of a pencil.