Many companies have implemented their business processes in Web applications which must be frequently adapted so as to stay aligned with new business process requirements. Service-oriented architectures (SOAs) constitute an appropriate option to manage the continuous changes in those processes by facilitating their alignment with the changing underlying system services. In this context, firms are trying to migrate their Web applications to new software architectures such as SOAs. However, this migration is usually carried out ad-hoc by means of non-reusable and error-prone manual processes. Similarly, the alignment between the business processes and the underlying services identified is usually done by hand. This work presents a model-driven semiautomatic approach to modernize legacy Web applications to SOAs. The approach is focused on an automatic semantic process aimed at discovering the services that can be used to implement the business processes (defined by the companies), then aligning these processes with the underlying services. A semantic algorithm is provided to aid the migration architect during the alignment process. The case study carried out shows that the alignment process results obtained by the semantic algorithm presented in this paper are similar to those obtained by the experts manually. Finally, SOA orchestration artifacts are generated from the semantic algorithm results. INDEX TERMS Legacy Web applications, service-oriented architecture, semantic algorithms, model-driven techniques.