Fast electrons produced by a 10 ps, 160 J laser pulse through laser-compressed plastic cylinders are studied experimentally and numerically in the context of fast ignition. K(α)-emission images reveal a collimated or scattered electron beam depending on the initial density and the compression timing. A numerical transport model shows that implosion-driven electrical resistivity gradients induce strong magnetic fields able to guide the electrons. The good agreement with measured beam sizes provides the first experimental evidence for fast-electron magnetic collimation in laser-compressed matter.