It’s not every day that Bernie Sanders praises the richest man alive. But on Tuesday, Sanders did exactly that, tweeting props to Jeff Bezos for Amazon’s decision to raise its minimum wage to $15, a move that will affect a quarter-million Amazon workers and 100,000 seasonal employees.

The friendship surely won’t last, given Bezos’s immense wealth and Sanders’s lefty politics, but it was nevertheless a stunning moment for Sanders, who has made Bezos the face of stark income inequality and America’s new Silicon Valley aristocracy. In September he even co-sponsored the Stop BEZOS Act, a bill that would tax corporations for every dollar of public assistance that their workers received. Amazon, for its part, released a rare public statement rebutting Sanders’s claims about the company’s well-documented mistreatment of its workers.

The Stop BEZOS bill was controversial—if enacted it would be impossible to enforce and would create widespread chaos—but its main purpose was to shame Amazon into improving its working conditions. Following Tuesday’s announcement, it’s a tactic that Sanders and other Democrats may use again when dealing with giant companies like Walmart and Apple.

But Amazon’s decision to raise its minimum wage was influenced by a number of other factors, and says a great deal about the political complexity of running an enormous (in this case, $1 trillion in market value) corporation. Like other companies, Amazon is very conscious of the political damage that can be done by being on the wrong side of certain issues. At the same time, taking safe stances can be a useful branding tool in creating an aura of corporate social responsibility. By raising its minimum wage to $15, Amazon is garnering the most political capital it can from taking a position that very likely would have been forced on it anyway.

For much of its existence, Amazon and Jeff Bezos have ruthlessly pursued cost-savings. The company skipped out on sales tax, to the detriment of states and small businesses; it targeted its weaker competitors in an effort to gain maximal market share (Bezos even told employees to hunt book publishers the way “cheetahs” pursue “sickly gazelles”); and it expanded by relying on cheap, often temporary labor, much of which was contracted out. There have been a slew of lengthy investigative reports about the horrible conditions in Amazon’s warehouses, where workers making minimum wage (or close to it) often are barred from taking bathroom breaks, labor in unsafe conditions, and are fired when they get injured.

In spite of this, Amazon enjoyed widespread bipartisan support for much of its rise, held up by business-friendly Republicans and tech-friendly Democrats as a sterling example of American ingenuity. Given the lack of any appetite for regulation on Capitol Hill, Amazon was happy to ignore its critics. But over the last few years, the environment has begun to change, with politicians—notably Sanders and Elizabeth Warren, along with some on the right—calling for greater regulation. In the fall of 2015, The New York Times published a report detailing Amazon’s brutal workplace culture and mistreatment of its white-collar workforce. The company, which had by then hired former Obama Press Secretary Jay Carney, pushed back aggressively against the piece, the first big sign that it was taking media coverage more seriously.

Amazon is as ambitious as ever. It recently became the second trillion dollar company in American history (the first was Apple). More Americans subscribe to Amazon Prime than regularly attend church. The company is producing movies and television, and pushing into the online advertising business. It is exploring artificial intelligence and health care. Its cloud computing wing may be losing its competitive edge, but remains insanely profitable. It owns Whole Foods, but its physical retail empire is really only beginning. And yet, despite the company’s unprecedented power, it is vulnerable in new ways. Like its competitors, Amazon is aware that the highly favorable political environment in which it was born is dissipating and may not return again.

There’s no doubt that the Stop BEZOS Act played a major role in the company’s decision to raise its minimum wage. The same goes for the media coverage of its treatment of low-wage workers. Amazon could shake off that kind of criticism a few years ago, but now it’s grist for legislators like Sanders who are casting billionaires like Bezos as the robber barons of the 21st century. “Count to ten,” Sanders tweeted earlier this year. “In those ten seconds, Jeff Bezos, the owner and founder of Amazon, just made more money than the median employee of Amazon makes in an entire year.” An earlier announcement that Bezos was donating $2 billion of his vast fortune resulted in eye rolls, thanks in part to the low pay being earned by Bezos’s employees. Shame is always a vital tactic in politics; with Stop BEZOS, Sanders and his co-sponsor Ro Khanna shamed Amazon into doing the right thing.

It’s no accident that Amazon settled on $15. Over the past four years, Fight for $15, a group advocating for a higher minimum wage, has won a host of victories in states and cities across the country. Through short strikes and a public relations push, Fight for $15 has also embraced shame as a tactic, leaving corporations with the choice of improving their working conditions or enduring long periods of bad press. The movement has pushed the minimum wage into the national conversation, and on Tuesday, Amazon decided it would rather have it as a friend than an enemy. One of the most important aspects of the company’s announcement was that it urged its rivals to follow suit—and pledged to spend resources to push the national minimum wage higher.

By raising the minimum wage, Amazon took an arrow out of the quiver of its critics. The next time the media comes knocking, the company is now able to point to something tangible that it has done for its workers. And it’s also a sound business decision. The labor market is very tight right now, particularly for low-wage workers. Amazon’s low-wage employees often work grueling jobs, often during the holidays. So it is incentivized to raise its wages.

There is a sense right now that this is a major development—that other companies will have to pony up more money for workers, too. But it remains to be seen whether that will happen. Moreover, it’s not yet clear how many people will benefit at Amazon itself. The company relies heavily on people who aren’t technically employees—who are employed by contractors, for instance. Much of the work it does is automated, or will be automated in the near future. Amazon’s market power is still enormous and bad for wage growth broadly. Still, by raising its minimum wage to $15, it did the right thing—if not necessarily for the right reasons.