As natural killers of bacteria, bacteriophages have forced bacteria to develop a variety of defence mechanisms. The alteration of host receptors is one of the most common bacterial defence strategies against phage infection, which completely blocks phage attachment but comes at a potential fitness cost to the bacteria. Here, we report the cost-free, transient emergence of phage resistance in Salmonella enterica subspecies enterica serovar Typhimurium through a phase-variable modification of the O-antigen. Phage SPC35 typically requires BtuB as a host receptor but also uses the Salmonella O12-antigen as an adsorption-assisting apparatus for the successful infection of S. Typhimurium. The α-1,4-glucosylation of galactose residues in the O12-antigen by phase variably expressed O-antigen glucosylating genes, designated the LT 2 gtrABC1 cluster, blocks the adsorption-assisting function of the O12-antigen. Consequently, it confers transient SPC35 resistance to Salmonella without any mutations to the btuB gene. This temporal switch-off of phage adsorption through phase-variable antigenic modification may be widespread among Gram-negative bacteria-phage systems.