This paper reports a fast, energy-efficient, and complementary metal-oxide-semiconductor (CMOS) compatible nanoelectromechanical non-volatile memory (NEM-NVM) for in-memory computing. To achieve a fast speed and ultra-low energy consumption, we introduced an out-of-plane electrode configuration that enables efficient scaling of the actuation air gap and stiffness, the most important parameters of the operating speed and energy. We also utilized well-established CMOS manufacturing techniques to reliably fabricate the NEM-NVM. The fabricated NEM-NVM has a fast programming speed (< 100 ns) and ultra-low programming energy (< 10 fJ/bit). Furthermore, for the first time, we demonstrated that our NEM-NVM can perform logical operations such as AND, XOR, and NAND logic gates by exploiting the operation mechanisms and non-volatility of the NEM-NVM.