Optically active spin defects in wide-bandgap materials have many potential applications in quantum information and quantum sensing. Spin defects in two-dimensional layered van der Waals materials are just emerging to be investigated. Here we demonstrate that optically-addressable spin ensembles in hexagonal boron nitride (hBN) can be generated by femtosecond laser irradiation. We observe optically detected magnetic resonance (ODMR) of hBN spin defects created by laser irradiation. We show that the creation of spin defects in hBN is strongly affected by the pulse energy of the femtosecond laser. When the laser pulse number is less than a few thousand, the pulse number only affects the density of defects but not the type of defects. With proper laser parameters, spin defects can be generated with a high probability of success. Our work provides a convenient way to create spin defects in hBN by femtosecond laser writing, which shows promising prospects for quantum technologies.