How do you spare Papyrus in Undertale?

Quick answer: Never use FIGHT. Survive his attacks until his special attack ends, then choose Spare. If you lose to him three times, he offers to let you skip the fight.
Show walkthrough (quest spoilers)
Do not attack
Use Act or Spare each turn and dodge his bones. His blue attack turns your SOUL blue, so gravity pulls it down and you must jump over the bones.
Wait for the special attack
After several turns, Papyrus gets ready for his special attack. The Annoying Dog runs off with it, so he uses an absolutely normal attack instead, which is harder than his earlier ones. Survive it, then Spare him to end the fight.
If he captures you
If your HP hits zero, Papyrus captures you instead of killing you and puts you in his capture zone, which you can simply walk out of. Lose to him three times and he offers to skip the fight.
Flirting
You can Flirt with him during the fight. It changes the dialogue and how his date with you goes, not how the fight ends.
After the fight
Spare him and he lets you go on, and offers to hang out at his house. See the Snowdin walkthrough for what comes next.
