Cobalt-catalysed sp2 C–H bond functionalization has attracted considerable attention in recent years because of the low cost of cobalt complexes and interesting modes of action in the process. In comparison, much less efforts have been devoted to the sp3 carbons. Here we report the cobalt-catalysed site-selective dehydrogenative cyclization of aliphatic amides via a C–H bond functionalization process on unactivated sp3 carbons with the assistance of a bidentate directing group. This method provides a straightforward synthesis of monocyclic and spiro β- or γ-lactams with good to excellent stereoselectivity and functional group tolerance. In addition, a new procedure has been developed to selectively remove the directing group, which enables the synthesis of free β- or γ-lactam compounds. Furthermore, the first cobalt-catalysed intermolecular dehydrogenative amination of unactivated sp3 carbons is also realized.