The membrane (M) protein is the most abundant structural protein of coronaviruses including SARS-COV-2 and plays a central role in virus assembly through its interaction with various partner proteins. However, mechanistic details about how M protein interacts with others remain elusive due to lack of high-resolution structures. Here, we present the first crystal structure of a coronavirus M protein from Pipistrellus bat coronavirus HKU5 (batCOV5-M), which is closely related to SARS-COV-2 M protein. Furthermore, an interaction analysis indicates that the carboxy-terminus of the batCOV5 nucleocapsid (N) protein mediates its interaction with batCOV5-M. Combined with a computational docking analysis an M-N interaction model is proposed, providing insight into the mechanism of M protein-mediated protein interactions.