This paper presents a single-phase Virtual Synchronous Machine (VSM) and its possible application for providing Vehicle-to-Grid (V2G) services from domestic battery chargers of Electric Vehicles (EVs). In a VSM, the power converter is controlled to emulate the inertia and the damping effect of a synchronous machine. Thus, a VSM-based EV charger can contribute to the spinning reserve and the frequency regulation of the power system. In case of grid outages, the VSM can seamlessly establish an islanded grid and supply local loads from the battery onboard the EV. In order to avoid the influence on the virtual inertia from power oscillations associated with a single phase circuit, the proposed control scheme relies on a virtual two-phase system for calculating active and reactive powers. The proposed VSM implementation is described in detail and its dynamic performances in grid-connected as well as stand-alone operation are demonstrated by numerical simulations and by laboratory experiments.