Now-a-days manufacturing processes are becoming more and more complex which constantly complicate the management of their life cycle. Although, in order to survive and maintain a good position in the competitive industrial context, industrials have understood that they must optimize the whole life cycle of their manufacturing processes. The maintenance constitutes one of the key processes indispensable to ensure the proper functioning and to optimize the lifetime of machines and production lines, and thus to optimize quality and production costs. Therefore, its automation and optimization represent until now a center of interest for researches and manufacturers, especially those related to the integration of artificial intelligence tools in the industry. In this context, several new concepts and technologies have emerged, particularly in the context of industry 4.0. One of these new concepts is digital twins, which has become a promising direction to optimize manufacturing processes lifecycle. However, the implementation of this technology faces several complex problems related to the interoperability between physical entities and their virtual counterparts, as well as to the logical reasoning between the different elements constituting the digital twin. It is in this context that an approach based on digital twins and ontologies is proposed. The originality of this paper lies in two important points: the first is the exploitation of the expressiveness and reasoning capabilities of ontologies to solve cyber-physical interoperability problems at the digital twin level, while the second is the automation of the whole maintenance process and its decision making key points using the inference potentialities of ontologies. The applicability and effectiveness of the proposed approach is validated through an industrial case of study.