San Diego guard Johnny Dee hits a three point shot from the corner against San Diego State during the second half of an NCAA college basketball game won by San Diego State 65-64 Thursday, Dec. 5, 2013, in San Diego. Dee finished with 21 points. (AP Photo/Lenny Ignelzi)
(The Associated Press)

San Diego coach Bill Grier urges his team during the first half of an NCAA college basketball game against San Diego State Thursday, Dec. 5, 2013, in San Diego. (AP Photo/Lenny Ignelzi)
(The Associated Press)

San Diego State guard Xavier Thames takes a hard foul from San Diego forward Jito Kok while trying to get off a shot during the second half of an NCAA college basketball game won by San Diego State 65-64 Thursday, Dec. 5, 2013, in San Diego. Thames led San Diego State with 17 points. (AP Photo/Lenny Ignelzi)
(The Associated Press)

The San Diego Toreros are the city's second-best basketball team again, if just by one point.

Xavier Thames made four free throws in the final 12.2 seconds and No. 24 San Diego State escaped with a 65-64 win against San Diego on Thursday night after Duda Sanadze's 3-point shot bounced off the rim as time expired.

"I thought that was a pretty good city championship — a good battle between two pretty good defensive teams," USD coach Bill Grier said. "I thought our guys kept fighting back. Other than the ball going in, I really can't ask for more."

Thames finished with 17 points and Josh Davis had 10 points and 15 rebounds for the Aztecs (6-1), who were playing for the first time since jumping into The Associated Press Top 25 following their title run in the Wooden Legacy.

The Aztecs beat the crosstown rival Toreros (7-3) for the eighth straight year despite losing most of a 10-point lead late in the second half.

Sanadze made two free throws with 4.8 seconds left to pull San Diego within one point. Then he tied up Thames after the inbounds play, giving the Toreros possession and a shot at the win. Sanadze got a good look at the basket but his shot went off the rim.

"We were just trying to steal the ball because 4 seconds, that's the only chance we had," Sanadze said. "So we defended real good on press defense. We just got the ball and it was a huge play and we had a chance to win the game.

"It was a pretty good look. Coach told me I could take it again. I hope to make it next time."

Skylar Spencer and Dwayne Polee had 12 points each for San Diego State.

SDSU outrebounded the Toreros 44-29.

"I'm proud of our guys," Grier said. "They have nothing to hang their heads about. We have to get better on the glass. We knew that coming in. They are so good on the offensive glass. I really think that was the whole difference in the game. They had 29 second chances. We had two."

SDSU led 57-47 with 6:30 left before going cold from the field. Its last field goal was Davis' left-handed layup with 5:25 left.

USD rallied behind Dee, who made consecutive 3-pointers to help pull the Toreros to 61-60 with 1:37 left.

"One thing this team has is fight and they showed it in a lot of stretches throughout the game," Grier said.

USD's Dennis Kramer lost the ball out of bounds with 16.6 seconds to go. Thames was fouled by Anderson and made two free throws with 12.2 seconds left. Sanadze hit two with 7.4 seconds remaining, Thames made two more with 5.9 seconds to play and Sanadze sank two with 4.8 seconds left to make it a one-point game again.

Thames and Polee made consecutive 3-pointers to help the Aztecs take a 47-41 lead with 13 minutes to go. JJ O'Brien had a big blocked shot and Davis made two free throws. Davis had a steal that led to Polee's slam dunk, and Thames made one of two free throws for SDSU's biggest lead, 57-47, with 6:30 left.

SDSU appeared to be pulling away with 5½ minutes left in the first half when Winston Shepard converted a three-point play and Thames made a baseline jumper for a 25-19 lead.

But the Toreros outscored the Aztecs 13-7 to forge a 32-all halftime tie.

After Sanadze and Dee made layups, Anderson hit a 3-pointer and was fouled. He made the free throw for a four-point play. Dee hit a 3-pointer and Thomas Jacobs made a layup.

SDSU's only scoring in that stretch was a jumper by Polee, single free throws by Dakarai Allen and O'Brien, and a 3-pointer by Polee.

"That was a very, very exciting game," SDSU coach Steve Fisher said. "The play was not always sensational, but the effort was sensational. I know the Torero fans are going away disappointed, but they got their money's worth. Both crowds should be proud of how hard the guys fought."