Boeing Co. technicians voted to form the first collective bargaining unit at the planemaker’s factory in South Carolina, scoring a rare victory for organized labor in a state traditionally hostile to unions.

The “micro-unit” will represent more than 170 flight-line workers, a small subset of the 7,000 mechanics who build Boeing 787 Dreamliners in North Charleston. But the result gives the International Association of Machinists and Aerospace Workers a foothold in a so-called right-to-work state. Boeing said it would challenge...