How do porcupines keep from pricking each other while mating?
The female stood with the tail held sharply to one side, and the quills on 
  the back lying very flat.  The male stood on his hind legs, while the 
  front legs grasped the sides of the female. There was no repetition  of the act.


The male's urethra is 115-120 mm long, and his penis is 75 mm, so the he doesn't need to be as close to the female as one might think.  The retractor muscles are attached to the lower portion of the pelvis, which is likely well below the level at which the male's quills end.

Apparently, a dozen or so porcupines will den up in close quarters for the winter, so one can probably guess they have a good sense of whether their spines are hurting another, but that's only conjecture.

I suppose the take-home message is, nature will find a way.

Struthers, P.H. (1928) Breeding Habits of the Canadian Porcupine (Erethizon dorsatum).  Journal of Mammalogy, 9(4), 300-308. http://www.jstor.org/pss/1374084

Mirand,E.A., Shadle,A.R.(1953).  Gross anatomy of the male reproductive system of the porcupine
Journal of Mammalogy, 34(2), 210-220. http://www.jstor.org/pss/1375622