A Co-based single-molecule magnet confined in a barium phosphate apatite matrix with a high energy barrier for magnetization relaxation.