A recent spate of high-profile scandals on Madison Avenue involving accusations of sexist and racist behavior has put the spotlight back on the advertising industry’s lack of diversity. And now marketing clients are starting to leverage their budgets to insist on change.

Antonio Lucio, the chief marketing officer of HP Inc., HPQ -3.22% sent a letter to HP’s advertising and public relations agencies on Thursday demanding that they improve the makeup of their workforces by hiring more women and minorities. Mr. Lucio, who previously spent years as marketing czar for Visa Inc., has asked his agencies to come up with a plan to diversify their ranks within the next 12 months.

In the letter to HP’s five agencies, Mr. Lucio requested that each one submit a plan within 30 days that lays out how the firm will significantly increase the number of women and minorities in key creative and strategy roles.

“Including women and people of color in key roles is not only a values issue, but a significant business imperative,” the letter said.

HP’s agencies include Omnicom Group’s BBDO, Fred & Farid and Dentsu’s Gyro. It also uses two Omnicom PR firms. The technology company isn’t setting specific goals for each agency, but Mr. Lucio said he expects agencies to have 50% female representation, which is the gender makeup of HP’s marketing department.

If agencies don’t comply, Mr. Lucio said “anything is on the table,” including removal from HP’s roster.

HP, the personal computer and printer arm of the former Hewlett Packard Co., is putting pressure on its agencies to hire workforces representative of the broader population as the lack of diversity in industries from entertainment to technology becomes a hot-button issue. Madison Avenue has been grappling with the criticism for decades, but the issue has been reignited as of late after a number of incidents that have attracted international attention.

The chief communications officer of WPP’s J. Walter Thompson filed a harassment lawsuit against former CEO Gustavo Martinez, earlier this year—charges he has denied.

Other incidents have included the recent resignation of a top Publicis Groupe executive, Kevin Roberts, following comments he made that were dismissive of the importance of gender diversity in the ad business. A top Omnicom Group executive also stepped down in June after allegations of discriminatory behavior.

While women make up about half of the advertising industry, they represent only 11.5% of its creative directors, according to the 3% Conference, a movement dedicated to building a business case for more female creative directors in advertising.

Overall the advertising business has a “poor score” on diversity, said Mr. Lucio. He added that the sector does have a “significant participation of women at the lower level” but has a problem with moving women up the ladder.

Mr. Lucio “knows about BBDO’s commitment to double the number of female senior creative leaders we have in one year and obviously supports it,” said Andrew Robertson, BBDO’s chief executive officer. “His initiative to formalize an action plan on his business is something we welcome.”

Gyro Chief Executive Christoph Becker said HP’s demands “are critical, timely and something necessary in the industry.” Gryo has been working to improve its diversity, he added.

“Half of our global steering committee is now women, but we’ll not stop there: we want women to thrive at every level of the company,” Fred & Farid said in a statement.

Palo Alto, Calif.-based HP isn’t the only firm to push for change. General Mills Inc. is requiring that creative agencies currently competing to win the food giant’s creative business must be staffed with at least 50% women and at least 20% people of color within the creative department. General Mills said that “agencies don’t need to be at that level today, but we will have meaningful conversations with our partners to ensure they understand the importance of this shared commitment.” Advertising Age earlier reported the General Mills news.

Some of the onus for change does lie with the marketing client, who should demand diversity at the agencies it hires because it will help them be more successful, argues former advertising executive and consultant Cindy Gallop.

“Clients have the leverage because they are paying the fees,” she said this week on the WSJ Media Mix podcast. “I would love to see many more clients using that leverage because they have the power to transform our industry.”

Mr. Lucio couldn’t say why it’s taken so long for marketers to demand real change given that women control so much of household spending. He said that HP’s push for more diversity in the ad business was prompted in part by the fact that women buy 53% of personal computers and 45% of printers.

HP, is also holding itself accountable, saying it has been trying to improve the makeup of its own workforce. Tech companies have been under a microscope for their lack of diversity since major companies like Facebook, LinkedIn and Google started publicly releasing diversity data a couple of years ago that showed Silicon Valley workforces are short on women, African-American and Latinos in the upper ranks.

HP said its doesn’t yet have any numbers on the diversity breakdown of its overall workforce since Hewlett-Packard Co. split last year. The company split into Hewlett Packard Enterprise Co. and HP Inc. last fall.

Before the separation, women made up 33% of Hewlett-Packard’s global workforce. The company at that time didn’t release the total number of minorities in its workforce.

HP’s global marketing team, which includes roughly 1,000 employees, is about 55% female and 30% of the staff consider themselves people of color, the company said.

“We are going to need to make much bigger progress among African-Americans and Latinos,” Mr. Lucio said.

Write to Suzanne Vranica at suzanne.vranica@wsj.com