We show that a cosection of the obstruction sheaf of a perfect obstruction theory localizes the virtual cycle to the non-surjective locus of the cosection. We give algebraic constructions of localized Gysin maps and localized virtual cycles. Various applications of these constructions are discussed.