Stanford’s dancing — by the skin of its teeth!

The Cardinal, an 11-seed in the NCAA Tournament, will play six-seed Louisville tomorrow in Lexington, Ky. With a victory, Stanford would face the winner of the game between three-seed Texas A&M and 14-seed Pennsylvania on Saturday for a chance to make its first Sweet 16 since 2001.

The Cardinal men found out the news the same way as their fans, privately watching CBS’ Selection Show in their locker room. And the squad was just as excited as the faithful when it got the word.

“It was pandemonium,” head coach Trent Johnson said. “A couple of them said, ‘My goodness, Coach, I’ve never seen you like this.’ I think it was Brook [Lopez] that knocked me over.”

The first three announced regions of 16 — the Midwest, West and East — included fellow bubble teams Indiana, Illinois, Old Dominion, Purdue, Arkansas, Gonzaga and Texas Tech, but no Stanford. Still, the Cardinal held out hope for a spot in the South region.

And at 3:36 p.m., the magic word appeared on television sets around the country. Sixty-four teams had already been announced — Stanford was literally the last team into the tournament.

“Me and Brook were carrying Coach J,” said sophomore guard Anthony Goods of the post-announcement celebration. “It was kind of like a double hug, and then we ended up picking him up because Brook is seven feet. We just ended up carrying Coach J around the locker room while everybody was screaming.”

Johnson was confident about Stanford’s chances heading into the Pacific-10 Conference Tournament, but admitted growing nervous in the days after Stanford’s Thursday-night overtime loss to Southern California.

Goods missed two late, crucial free throws in the contest, his first action since suffering an ankle sprain at Washington nearly a month ago. Johnson said his star shooter felt guilty about his role in Stanford’s finish, so the announcement lifted a major weight from his chest.

“If anybody would have seen him the last two days, you would have thought he was on his deathbed,” said Johnson after the announcement. “I just told him, ‘Don’t worry about it. I wouldn’t want anybody else in that situation, shooting free throws, but you.’”

At first glance, Goods and company look to have a good shot against Louisville. The No. 16 Cardinals (23-9, 12-4 Big East) won seven of their last eight to tie for second in their 16-team conference, but beat only two NCAA teams (Pittsburgh and Marquette) on the season.

Louisville does sport a stingy defense that has allowed 75 points just twice the entire season. Offensively though, they prefer to bang inside rather than light up the arc, shooting just 33 percent deep and 66 percent on free throws, which plays right into Stanford’s hands.

“The good thing about it is that Louisville plays with bigs,” Johnson said. “The bigger the team, the more I like our chances. Smaller teams who can bring our posts away from the basket and attack them off the dribble have given us problems.”

Still, Louisville enters the contest as the six-point favorite, and for good reason. Their top six — 6-foot-11 junior center David Padgett, forwards Juan Palacios, Derrick Caracter and Terrence Williams, and guards Edgar Sosa and Jerry Smith — average at least eight points per game.

The team’s rebounding and ball-handling numbers are similarly strong under head coach Rick Pitino. The former coach of the Boston Celtics and college powerhouse Kentucky is regarded as one of the best in the business.

Two additional factors conspire against Stanford.

First, the contest is just 60 miles away from Louisville and Cardinals fans quickly scooped up unsold tickets at Kentucky’s Rupp Arena. Plus, after flying across the country yesterday, Stanford will need to be up for a 9:40 a.m. PST (12:40 p.m. local) start.

Johnson admitted the locale would represent a challenge, but refused to make excuses.

“We could play them in Jamaica for all I care,” he said.

The top seeds in Stanford’s region are No. 1 Ohio State, No. 2 Memphis, No. 3 Texas A&M and No. 4 Virginia, while Florida, North Carolina and Kansas hold the other one-seeds.

The Pac-10 had a banner day, placing six teams (No. 2 UCLA, No. 3 Washington State, No. 3 Oregon, No. 5 USC, No. 8 Arizona and Stanford) into the dance. Major snubs included Drexel, Air Force and Syracuse.

Stanford had made 11 straight NCAA Tournaments before missing the Big Dance and accepting an NIT bid last season. In that stretch under Mike Montgomery, the Cardinal made just one Final Four, in 1998.