The grid connected inverter takes the direct current and, in simplified terms, runs it through a transformer. The inverter runs the DC through two or more transistors that are rapidly turned on and off and feeding two different sides of the transformer to convert DC into AC.
The grid connected inverters require reference frequency to synchronize with the grid (e.g. 50 or 60 Hz) using a local oscillator and limit the voltage to no higher than the grid voltage.
The power produced is fed into your house/ office electrical panel and provides power for all needs. The excess power automatically flows out to the grid, spinning meter backwards.
Grid-tie inverters are also designed to quickly disconnect from the grid if the utility grid goes down to prevent the energy it transfers to the grid from harming any line workers who are fixing the line issues. This feature is known as Anti-Islanding.