The goals were scored by Thulasizwe Mbuyane and Diyo Sibisi (pictured).
The home side deserved the win as they looked the better side throughout and could have scored more goals had they taken their chances.
Cosmos did come back into the game during the second half but it was too late and Stars to their credit defended well.
The first goal came in the 23rd minute when Thulasizwe Mbuyane scored with a low right-footed shot from the left.
In the 44th minute Stars scored again when Diyo Sibisi scored with a left-footed shot from 20-yards out.
The win lifts Stars near the top half of the table on 11 points while Cosmos remain mid-table on 6 points.