RIYADH, Saudi Arabia—McKinsey & Co. has been paid millions of dollars in recent years advising Saudi Arabia’s government on an ambitious economic transformation. Over the same period, the global consultancy has hired at least eight relatives of high-ranking Saudi officials.

The consulting company has employed, among others, at least two children of the man who serves as the Saudi energy minister and head of the state oil company, a son of the finance minister and a son of the CEO of government-controlled Saudi Arabian Mining Co.

McKinsey has relationships that go back decades in Saudi Arabia, a country where government and business hierarchies are often defined by family ties. The firm said it hires based on merit—and said its Middle East offices have rejected more than 100 candidates with very influential relatives in the last five years.

“McKinsey is a meritocracy. We hire exceptional people and are confident in the robust policies and practices that underpin our recruiting and development both globally and locally,” the company said. The Wall Street Journal uncovered no allegations by U.S. or Saudi officials of wrongdoing by McKinsey in its Saudi hiring.

The hiring of officials’ relatives in other countries has drawn scrutiny from U.S. authorities in the past. J.P. Morgan Chase & Co. last year paid $264 million in criminal and civil settlements of federal claims, brought under the Foreign Corrupt Practices Act, that it hired unqualified relatives of Chinese officials to get business. A Justice Department official at the time called the hiring program “nothing more than bribery by another name.”