Its constitutional court said the current marriage law violated non-discrimination rules. The ruling also allows heterosexual couples to enter a civil partnership.
The move will bring the country in line with 15 other European countries.
The Netherlands became the first country to legalise same-sex marriage, in 2001.
The case was heard after a female couple challenged a 2009 law which allowed registered partnerships for same-sex couples, but not marriage.
In a statement, the court said the distinction between the different kinds of unions could not be upheld because it was discriminatory against same-sex relationships, as it forced people to disclose their sexual orientation in situations where that was not relevant.