The online estimation of battery states and parameters is one of the challenging tasks when battery is used as a part of the pure electric or hybrid energy system. For the determination of the available energy stored in the battery, the knowledge of the present state-of-charge (SOC) and capacity of the battery is required. For SOC and capacity determination often the estimation of the battery electromotive force (EMF) is employed. The electromotive force can be measured as an open circuit voltage (OCV) of the battery when a significant time has elapsed since the current interruption. This time may take up to some hours for lithium-ion batteries and is needed to eliminate the influence of the diffusion overvoltages. This paper proposes a new approach to estimate the EMF by considering the OCV relaxation process within only some first minutes after the current interruption. The approach is based on an online fitting of an OCV relaxation model to the measured OCV relaxation curve. This model is based on an equivalent circuit consisting of a voltage source (represents the EMF) in series with the parallel connection of the resistance and a constant phase element (CPE). Based on this fitting the model parameters are determined and the EMF is estimated. The application of this method is exemplarily demonstrated for the state-of-charge and capacity estimation of the lithium-ion battery in an electrical vehicle. In the presented example the battery capacity is determined with the maximal inaccuracy of 2% using the EMF estimated at two different levels of state-of-charge. The real-time capability of the proposed algorithm is proven by its implementation on a low-cost 16-bit microcontroller (Infineon XC2287).