Why did Harry spare Peter Pettigrew, while earlier having been determined to kill Sirius Black when he thought it was him who betrayed his parents?
Harry's impulse to kill Sirius Black was an emotional one, in the moment:
The taunt about his father rang in Harry's ears as though Black had bellowed it. A boiling hate erupted in Harry's chest, leaving no place for fear. For the first time in his life, he wanted his wand back in his hand, not to attack... but to kill.
Through the next few pages he makes as if to kill Sirius, and he even has his chance to do so... But he doesn't.
The seconds lengthened. And still Harry stood frozen there, wand poised, Black staring up at him...
Its quite clear that Harry didn't have it in him to kill Black, despite his earlier determination. Harry spared Peter for a quite similar reason that he would have spared Black - Harry is not a killer.
In addition, Harry spared Peter because he realized that his father would not have wanted their friends to become killers for his sake.
Harry tells Pettigrew:
"I'm not doing this for you. I'm doing it because - I don't reckon my dad would've wanted them to become killers - just for you."
He was the only way to definitively prove Sirius' innocence.
Sirius had spent over a decade in Azkaban accused of both killing Peter and a crime that Peter actually committed (blowing up a street and killing a number of Muggle bystanders). If Peter is discovered to be alive, after having faked his own death, then the charges against Sirius suddenly have considerably less weight (likely none).
Okay, but why did he have to be alive? Wizarding law enforcement don't tend to trust Veritaserum, Legilimency, etc. They're also likely to dismiss any claims that this corpse is somebody who was already believed to be dead for years already. The only way to prove that Peter Pettigrew was alive was for him to actually be alive and able to be questioned.
How many 13 year old children do you know that would commit murder? Harry had said he would kill Sirius but made no attempt to do so.
He was in front of a room full of witnesses.
He did not know the killing curse, maybe at the moment he was about to kill he realised that he had no idea how to commit murder.
Peter would be sent to Azkaban where unlike Sirius he would suffer from the dementors.