Flexible manufacturing systems (FMS) are highly adaptable production systems capable of producing a wide range of products in varying quantities. While this flexibility caters to evolving market demands, it also introduces complex scheduling and control challenges, making it difficult to optimize productivity, quality, and energy efficiency. This paper explores the application of digital twin technology to tackle these challenges and enhance FMS optimization and control. A digital twin, constructed by integrating simulation models, data acquisition, and machine learning algorithms, was employed to replicate the behavior of a real-world FMS. This digital twin enabled real-time dynamic optimization and adaptive control of manufacturing operations, facilitating informed decision making and proactive adjustments to optimize resource utilization and process efficiency. Computational experiments were conducted to evaluate the digital twin implementation on an FMS equipped with robotic material handling, CNC machines, and automated inspection. Results demonstrated that the digital twin significantly improved FMS performance. Productivity was enhanced by 14.53% compared to conventional methods, energy consumption was reduced by 13.9%, and quality was increased by 15.8% through intelligent machine coordination. The dynamic optimization and closed-loop control capabilities of the digital twin significantly improved overall equipment effectiveness. This research highlights the transformative potential of digital twins in smart manufacturing systems, paving the way for enhanced productivity, energy efficiency, and defect reduction. The digital twin paradigm offers valuable capabilities in modeling, prediction, optimization, and control, laying the foundation for next-generation FMS.