We observed the assembly of a nucleus-like structure in bacteria during viral infection. Using fluorescence microscopy and cryo-electron tomography, we showed that Pseudomonas chlororaphis phage 201φ2-1 assembled a compartment that separated viral DNA from the cytoplasm. The phage compartment was centered by a bipolar tubulin-based spindle, and it segregated phage and bacterial proteins according to function. Proteins involved in DNA replication and transcription localized inside the compartment, whereas proteins involved in translation and nucleotide synthesis localized outside. Later during infection, viral capsids assembled on the cytoplasmic membrane and moved to the surface of the compartment for DNA packaging. Ultimately, viral particles were released from the compartment and the cell lysed. These results demonstrate that phages have evolved a specialized structure to compartmentalize viral replication.