Industry 4.0 (I4.0) is characterized by the integration of digital technologies into manufacturing processes and highlights new requirements for industrial systems such as greater interoperability, decentralization, modularization, and independence. The traditional hierarchical architecture of Industrial Automation Systems (IAS) does not fulfill these requirements and is evolving to incorporate information technologies in order to support I4.0 applications. The integration among these technologies, equipment, and systems at different industry levels requires a migration from the legacy vertical architecture to a flat architecture based on services. Service-oriented architecture (SOA) and, more recently, microservices play a critical role in I4.0 by providing a framework for integrating complex systems and meeting those requirements. This paper presents the development of a Microservice-Oriented Architecture for Industry 4.0 (MOAI), initially focused on evolving IAS to the I4.0. The objective is to describe the development, deployment, and testing of an IAS architecture based on microservices prepared for I4.0 applications. On the contrary to developing the whole software for the industrial SOA, the MOAI was developed on top of the Moleculer framework, which allowed focusing on creating services and applications for the automation and process control industry context. The development of several microservices and security mechanisms for the MOAI is presented, as is the deployment of IAS applications as services such as process control, SCADA, discrete automation, among others. The MOAI was implemented in a process control pilot plant for experimentation. Experimental results of the MOAI for IAS applications are investigated, the microservice communication performance is evaluated, and the pros and cons of microservices for I4.0 are discussed.