Deuteronomy 21:
See also Why did Jesus have to suffer and die?.
The tree is a type of the cross. Christ fulfilled the above according to Galatians 3:23 his body shall not remain all night on the tree, but you shall bury him the same day, for a hanged man is cursed by God.
Similarly, 1 Peter 2:13 Christ redeemed us from the curse of the law by becoming a curse for us—for it is written, “Cursed is everyone who is hanged on a tree”
Then there was the piercing prophecies, Isaiah 53:24 He himself bore our sins in his body on the tree, that we might die to sin and live to righteousness. By his wounds, you have been healed.
Zechariah 12:5 But he was pierced for our transgressions, he was crushed for our iniquities; the punishment that brought us peace was on him, and by his wounds we are healed.
The piercing was fulfilled on the cross in John 19:10 I will pour out on the house of David and the inhabitants of Jerusalem a spirit of grace and supplication. They will look on me, the one they have pierced, and they will mourn for him as one mourns for an only child, and grieve bitterly for him as one grieves for a firstborn son.
Jesus himself prophesied the cross in Luke 9:34 But one of the soldiers pierced his side with a spear, and at once there came out blood and water.
Jesus predicted the lifting up of the cross in John 3:23 Then he said to them all: “Whoever wants to be my disciple must deny themselves and take up their cross daily and follow me.
Paul affirmed the cross in Philippians 2:14 And as Moses lifted up the serpent in the wilderness, so must the Son of Man be lifted up, 15 that whoever believes in him may have eternal life.
The instrument of death needed to be crucifixion because it was prophesied.8 And being found in appearance as a man, he humbled himself by becoming obedient to death— even death on a cross!
See also Why did Jesus have to suffer and die?.