Preventive maintenance schedules are increasingly important in today's complex and diverse production systems as they help to ensure the continuous operation of systems and reduce overall maintenance costs. This paper presents a novel method for designing a preventive maintenance schedule and spare parts inventory based on failure modes for complex systems with multiple components, using the Failure Modes and Effects Analysis (FMEA) method. The objective is to ensure the continuity of system outputs by modeling subsystems and components as parallel and series arrangements, and using a genetic algorithm to determine the optimal replacement intervals and spare parts inventory based on failure modes. In addition to ensuring the continuity of production outputs during maintenance activities, the approach is also useful in reducing system maintenance costs and increasing system reliability. The proposed approach is applied to a packaging system, and the effects of changing lead time, preventive replacement intervals, and production lost costs on the optimal policy are also examined. The proposed approach is expected to improve system reliability, reduce maintenance costs, and be applicable to any type of complex system at any stage of its development.