Alberto Contador had his overall lead sliced in half on the penultimate day of the Giro d'Italia although the Spaniard remained on course for the title after the 20th stage.