Cavani 35, left Manchester United at the end of the season after his contract ran out.
He spent two seasons at Old Trafford, scoring 19 goals in 59 appearances in all competitions.
Valencia announced on their website that they have agreed on a deal to sign the former PSG forward.
OFFICIAL STATEMENT | @ECavaniOfficial#WelcomeCavani#CORVCF | #VCFDNA— Valencia CF (@valenciacf_en) August 29, 2022
"Valencia CF have reached an agreement to sign Edinson Cavani for the next two seasons until the 13th of June 2024,".
Cavani will be hoping to shine for Valencia, who finished ninth in the Laliga last season.
Italy World Cup winner Gennaro Gattuso was appointed in the summer to turn the club's fortunes around.
Cavani is expected to make his Valencia debut against Getafe on Sunday.