A cleric who campaigned to steer Iran on a more moderate course has won the presidential election. It is an outcome that has pushed the country to the brink of an extraordinary political transformation, and lifted the spirits of those demanding reform.