DETROIT (AP) -- Jim Harbaugh and Jim Schwartz have helped turn San Francisco and Detroit into contenders, earning plenty of attention for the energy and attitude they bring to the sidelines.
That intensity was on full display Sunday during a postgame dustup after the 49ers handed the Lions their first loss of the season.
Harbaugh, the San Francisco coach, came running across the field and gave his Detroit counterpart an exuberant handshake and then a slap on the back. Schwartz took exception and chased Harbaugh back toward the tunnel, but the two were kept separated. Players gathered and appeared to restore order.
"I went to congratulate Coach Harbaugh and got shoved out of the way," Schwartz said after his team's 25-19 loss. "I didn't expect an obscenity at that point. Obviously, when you win a game like that, you are excited, but there is a protocol."
Schwartz wouldn't elaborate much.
"I'm sure it is on video, and you can see it," Schwartz said.
Harbaugh took the blame but wasn't about to tone down his excitement after the big win.
"That's totally on me," Harbaugh said. "I shook his hand too hard."
NFL spokesman Greg Aiello said the incident will be reviewed.
Alex Smith threw a go-ahead 6-yard scoring pass to Delanie Walker on fourth down for San Francisco with 1:51 left, and the 49ers added a field goal less than a minute later for the final margin. Detroit (5-1) lost for the first time in 10 regular-season games dating to last year. The Lions also won all four of their preseason games.
Walker's touchdown stood after video review didn't show definitively whether the San Francisco tight end's right knee was down before the ball reached the goal line.
"I knew I got in there," Walker said. "I crossed the plane, but we were in their house and we got some bad calls early on in the game. But I didn't think twice about it."
After Walker's touchdown made it 22-19, Detroit had a chance to drive for a tying field goal or a go-ahead TD, but couldn't get a first down against a swarming defense that hit and confused quarterback Matthew Stafford from the start.
David Akers gave San Francisco (5-1) a six-point lead with 1:02 to go with a 37-yard field goal, and the Lions did no better with their next attempt at a winning drive.
Smith was 17 of 32 for 125 yards, going early and often to Michael Crabtree , who had nine receptions for 77 yards. Frank Gore ran 15 times for 141 yards and scored a TD that pulled the 49ers within three after they were outscored 10-0 in the first quarter.
The 49ers are not only atop the NFC West, but they're opening up some ground. Second-place Seattle (2-3) had an open date.
"I've never been a part of anything like this, especially since I've been a pro," Smith said. "The defense played unbelievable today. They deserve all the credit."
Stafford was 28 of 50 for 293 yards and two TDs. He was sacked in the end zone for a safety in the second quarter.
"Matt didn't have a whole lot of time today," Schwartz said. "We had a hard time getting the run game going. When it's one-dimensional that way, and I think it was, you're going to have a difficult time."
Detroit ran for only 66 yards.
Jason Hanson missed a 52-yard field goal attempt that would've given Detroit a four-point lead late in the first half, then Akers made a 55-yard kick. That put the 49ers ahead 12-10 as time expired in the half.
In the fourth, Stafford connected with Nate Burleson on a 5-yard pass into the end zone that was ruled incomplete on the field. It was overturned after video review, giving Detroit a 19-15 lead. Burleson caught the ball and got both feet down, then lost the ball after tumbling beyond the end zone - a play similar to Calvin's Johnson's well-documented play in the end zone that was ruled incomplete last year at Chicago.
The Lions couldn't hold the lead and were left to rue a couple trips deep into San Francisco territory that ended with short field goals - one in the first quarter and another in the third.
"We're not going to go 16-0," Schwartz said. "We have to protect the quarterback better, have to run the ball better, make more plays down the field. We have to stop the run better, we have to convert field goals."
The 49ers overcame 15 penalties, including five false starts at raucous Ford Field.
"Once you get a couple false starts, it's like throwing gasoline on a fire," Smith said.
Notes: San Francisco and Chicago combined for 14 false starts at Detroit, matching Houston's record from 2004 for the most false starts by visiting teams in back-to-back games since 1991, according to STATS LLC. ... Harbaugh played for Baltimore in 1998, when Schwartz was a Ravens assistant.