Longtime Green Bay foe Randy Moss found the end zone with his new team as the San Francsico 49ers defeated the Packers 30-22 on the road to open their season.

After disappointing losses last year in the playoffs, both the Green Bay Packers and the San Francisco 49ers had hoped to start off 2012 with a win. Each lost in consecutive weeks to the New York Giants as they made their run to the Super Bowl.

The two teams had the best records in the NFC last year and Sunday's game was one of the top matchups of the NFL's first week.

San Francisco's defense played extremely well throughout the game and was reminiscent of last year when they had the top-ranked unit. They only allowed seven points through the first half.

"We were just tremendously on it today, and that was a big part of our victory," 49ers coach Jim Harbaugh told the Associated Press.

49ers Quarterback Alex Smith hit Randy Moss for a 14-yard touchdown to put the team up 10-0. As a player for the Minnesota Vikings, Moss tormented Green Bay fans for years with acrobatic catches, big games, and of course, wild celebrations, although Sunday's was more subdued.

"He had a lot of juice, he blocked well," Harbaugh said. "He got open and he was a great big target in there."

Smith had a solid game for San Francisco, throwing for 211 yards and two touchdowns on an efficient 20 for 26 attempts. Running back Frank Gore also put up good numbers, rushing for 112 yards and touchdown.

Green Bay responded with a touchdown from Aaron Rodgers to tight end Jermichael Finley, but couldn't score again in the first half. San Francisco added two field goals, including a record-tying 63-yard kick from David Akers at time expired in the second quarter, to go up 16-7.

The three other kickers to make a 63-yarder were New Orleans' Tom Dempsey in 1970, Denver's Jason Elam in 1998, and most recently Oakland's Sebastian Janikowski in 2011

The second half had more scoring for both teams and got started off on a 75-yard electrifying punt return from Packers wide receiver Randall Cobb. Rodgers added a two-point conversion to Jordy Nelson to get closer at 23-15.

Rodgers faced pressure all day and was sacked three times. He also threw an interception to 49ers linebacker NaVorro Bowman that set up Gore's touchdown. On the Packers' final drive, Rodgers was sacked on third down, forcing a fourth down play that ended with a deep incompletion.

"You turn on the TV or you hear people say, 'No, the Packers are going to beat them by two or three touchdowns,' and you hear everybody saying all this and that,'" San Francisco linebacker Patrick Willis said. "But we know what we have and we have complete confidence in one another here across the board, offense, defense and special teams. As long as we have that and we're still together, I think we're capable of doing anything."

There were also issues in the game with the replacement officials, who for the most part did a good job working games all weekend. In this game the officials called 18 penalties, including an unsportsmanlike conduct penalty on San Francisco's Aldon Smith in the first quarter for taking off his helmet after a sack. Replays showed that Smith's helmet incidentally had begun to come off after making contact with Rodgers.

"Some of the penalties were definitely a little bizarre," Rodgers said.

The Packers added another touchdown on a 10-yard pass to James Jones with six minutes left, but couldn't overtake the lead.

When asked about his team's comeback, Packers coach Mike McCarthy didn't make excuses. "Boy, I'd like to answer that truthfully," McCarthy said. "We're 0-1. We have some work to do. We're up in 96 hours."

The Packers play on Thursday night football this week against the Chicago Bears on the NFL Network. San Francsico will take on the Detroit Lions at home on Sept. 16 on Sunday night football.