Priori Incantatem (Latin: priori "before" + incantatem "incantation") reveals the last spell cast by a wand.
When two wands share a core and one kills the other's owner, the surviving wand forces the "echo" of the dead wizard's last spell to manifest as ghostly replicas.
At the climax, Harry's wand (phoenix feather core, twin to Voldemort's) triggers Priori Incantatem when Pettigrew kills Cedric with Voldemort's wand. The effect forces out Avada Kedavra, producing spectral images of Cedric and Voldemort's recent victims.
It's not a standard spell—it's a rare, automatic reaction between twin cores.