What really saved Harry was him being the owner of the Elder Wand, which wouldn't kill its master and instead rebounded to its attacker. I guess it decided horcrux Voldy would do instead of Voldy proper in the forest. Otherwise it would have killed both Harry and the horcrux.
It might also be possible that the Elder Wand allowed a Killing Curse to be directed at Harry in that instance, because Harry (the wand's master) was allowing himself to be killed by Voldemort. Voldy said that he'd kill everyone in Hogwarts if Harry didn't submit to an execution, and Harry came to terms with that and was okay with ending his own life, so Harry gave himself up, without any resistance.
Which is presumably how the sacrifice spell works. If Party A (Hogwarts) is guaranteed to die, and Party B (Harry) is guaranteed to be safe, but Party B (Harry) loves Party A (Hogwarts) and steps in to take death in their place, then that can create a love-powered ancient magic protection spell, and the Grim Reaper will not allow the Killer (Voldy) to harm Party A (Hogwarts). It's not Party B's fault that the Killer sucks at killing so much that he can't even kill someone who is standing right there, even authorizing them to use their own wand for the kill. Party B (Harry) held up his part of the bargain, so the spell still works.
One of the possibilities is, the Killing Curse is a 100% certain death spell. But Harry had 110% soul (since he was Voldemort's Horcrux). So the Killing Curse first killed Voldemort's soul fragment, and then made Harry 90% dead/10% alive. Harry's soul saw the afterlife, but he was given the choice of staying down and falling into a 100% dead state, or putting in some effort, struggling to get back up, and pulling himself back to a 100% alive state. It's also possible that this choice was a bonus attributed to Harry's "Master of Death" status.
It's also possible that being the "Master of Death" makes Harry literally immortal. It might be possible that Harry can't die. You could kill him as many times as you want, and he'll keep getting back up. Or maybe he'll just keep getting back up so long as he keeps on choosing to get back up.
There's a lot that's unclear about these things.