The opposition Social Democrats refused to recognize the result Monday, alleging voter intimidation by the government, but international monitors described the vote as well run.
With 99.9 percent of the vote counted Monday, the conservative VMRO-DPMNE had won 42 percent and 61 seats — one short of a majority in the 123-member parliament. The Social Democrat-led opposition alliance got 24.9 percent and 34 seats, according to the State Election Commission. Turnout was 64 percent.
In a separate vote Sunday, conservative President Gjorge Ivanov won a second five-year term in a runoff for the largely ceremonial post.
The opposition has accused Gruevski of state interference in election campaigning — including alleged threats made to civil servants to back the government — and said it would not recognize the results of either poll.
An international observer mission said it had received reports of voter intimidation but said the vote went well.
"The presidential and parliamentary elections were efficiently administered. The citizens were offered a clear choice in this election," said Christine Muttonen of the Organization for Security and Co-operation in Europe.
VMRO rejected the claims of voter intimidation and its supporters celebrated in the streets of the capital Skopje early Monday, waving red party flags.
"Macedonia had peaceful, fair and free elections. Macedonia is the biggest winner. We can be proud," Gruevski told supporters.
He had called the election a year early, gambling on the success of his economic stimulus program which has helped landlocked Macedonia's economy recover from stagnation triggered by the eurozone crisis.
In 2013 the economy grew by 2.5 percent and is expected to expand by 3 percent this year. But unemployment remains high at 28.7 percent.
AP writer Derek Gatopoulos in Athens contributed.