In this paper, we consider a \(MAP/E_{k}/1\) queue with working vacation. Customers arrive according to a Markovian arrival process and service time follows generalised Erlang distribution of order n. The first k stages of service are called preliminary service and the service in the remaining n−k stages is called the main service. When the system becomes empty at the time of completion of service, the server will go on a working vacation. Customers who arrive during the working vacation are provided only the main service. The server switches to normal mode when the vacation expires, or N customers are continuously served during working vacation, whichever occurs first. The customer in service at the working vacation expiration epoch is provided the service from the beginning. We analyse this model using the matrix-geometric method. We obtain the expected service time and waiting time of a tagged customer. Other performance measures are computed and a cost function is constructed to find optimal N value corresponding to the input parameter values.