Townsend's men had endured an awful start to their campaign in a heavy opening defeat to Ireland, while hosts Japan's shock win against the Irish dealt a further blow to Scotland's hopes of advancing from Pool A.
But where Scotland had been poor from the off against Ireland, they were much improved on Monday and led 20-0 at the break.
Samoa's Ed Fidow then received two yellow cards and was dismissed for conceding a pair of penalty tries to hand Scotland a commanding 34-0 bonus-point win that brings them back into contention.
Townsend accepted responsibility for the Ireland defeat but believed this match gave a greater impression of where Scotland are at.
"That was a true reflection of who we are and what we are capable of and what playing for Scotland means to the players," he said.
"That was a tough challenge to face, knowing that if we underperformed we were out of the World Cup. To see the effort and togetherness was excellent.
"Last week, we missed the beginning of the game and I take responsibility for not preparing the team well enough to start well against Ireland. But that didn't make us a bad team.
"Tonight, it was great to see them get rewards for their effort."
— Scottish Rugby (@Scotlandteam) September 30, 2019
Samoa coach Steve Jackson praised Scotland while insisting his side were not yet "down and out", but much of the post-match conversation focused around the team's discipline.
While Jackson had suggested Samoa felt harshly treated when Rey Lee-Lo and Motu Matu'u were suspended prior to this game, he offered few excuses for Fidow.
"I suppose we can sit back and have a decent look at it overnight," he said. "But would Scotland have scored those tries?
"The first one is a bit difficult. You come in from the side but they were on their way to the try line. For the second one, it's hard when a player dives five metres out from the line.
"So we've just got to make better decisions and try to dislodge the ball a bit better than the way we defended there. But Scotland put themselves in those positions to score those tries. They probably deserved them anyway."
Asked if Samoa's approach could be questioned, Jackson replied: "Every team plays to the letter of the law.
"I'm not going to talk about the two yellow cards previously, but there have obviously been others who have escaped sanctions that we haven't.
"Again, these are decisions that get made by putting yourself in those positions. You're trying to stop two tries and there's going to be risk and reward.
"We don't intentionally go out there to get yellow cards - by no means do we coach or train that."
Photo Getty Images Caption: Scotland coach Gregor Townsend