In an almost unprecedented action, the Cofidis rider, who was lying ninth overall before the stage, ascended the 13km Angliru before taking his race number off underneath the finishing gantries and turning away.
The latter part of the course on the Tour of Spain's most important mountain stage was made lethal by intermittent torrential rain, and the Scot had crashed twice on the previous descent of the first-category Cordal, which immediately preceded the Angliru.
In the first accident both he and his teammate Guido Trentin went down simultaneously, but were able to continue without losing too much time. The second accident, though, was more serious, caused by a race vehicle touching his back wheel. The Scot went flying, cutting and bruising his right arm and knee.
The 25-year-old completed the last climb, before making his protest then going off in search of medical assistance. Millar was reported by team sources to have been infuriated by what he saw as inadequate signalling on the twisting, rain-soaked descent.
"I have never seen or heard anything like it in all the time I have been following cycling," said former continental-based British rider Graham Jones, who is reporting on the tour.
Millar, who last year won two stages of the Tour of Spain, later apologised to team-mates and mechanics and contacted his team owner, Francois Migraine, to explain his action.
UCI commissaires informed the team that while they could have overlooked his failure to finish, the act of removing his race number automatically disqualified Millar.
However, the rider's action will draw a sympathetic response from many. Some teams were kept waiting over an hour in the torrential rain at the summit for the descent from the single-track road leading off the mountain, clogged with broken down team cars, spectators and riders attempting to finish the course.
"It has been impossible to work in such conditions," the Cofidis sporting director, Francis Van Londesele, said. "The organisation has been disgraceful."