It was the first electoral defeat for Mr. Chavez in nine years .