In the digital age, cyber-attacks and data breaches pose complex challenges for organizations operating in cyberspace. Machine learning offers a promising solution to detect and prevent these threats, addressing issues like malware, ransomware, fraud, and spoofing. This chapter explores machine learning's role in cybersecurity, discussing algorithms and their applications in intrusion and malware detection. It also examines challenges and limitations in employing machine learning for cybersecurity. Providing valuable case studies, the chapter serves as a useful reference for researchers developing intelligent security systems.