Red Hat (NYSE: RHT) will keep its corporate headquarters in Wake County and add more than 500 jobs in the next five years, officials said Monday.

Red Hat (NYSE: RHT) plans to invest $109 million in its new headquarters, which will be between 300,000 and 400,000 square feet.

“North Carolina has been a strategic partner to Red Hat for more than a decade. The talent base we’ve been able to attract headquartered in this state has been phenomenal,” Red Hat Chief Executive Jim Whitehurst said.

Whitehurst said it could be several months before Red Hat settles on a site in Wake County for its headquarters. The company is now based at North Carolina State University’s Centennial Campus and employs close to 700 people in the state.

The state Economic Development Committee on Monday awarded Red Hat close to $15 million in incentives for a two-tiered expansion in the Triangle. The company will add 240 jobs in the next four years and will add another 300 in 2015 to accommodate new products, officials said.

The new jobs will have an average salary of $80,000 to $83,000, which is almost double Wake County’s average of $42,700.

The first Job Development Investment Grant, or JDIG, will refund up to $6.75 million of the state withholding taxes Red Hat pays for its new workers. The second JDIG, valued at up to $8.2 million, would be tied to the 2015 expansion.

Companies must meet hiring targets over several years to receive the full value of a JDIG.

State officials estimated the total economic impact of Red Hat’s expansion at $1.5 billion.

“We call this our company,” Gov. Beverly Perdue said, donning a red fedora. “It’s kind of like NASCAR. It was born here, it was bred here and we’re going to do whatever is legal to keep it here.”

Raleigh and the Triangle faced keen competition for Red Hat’s headquarters. Sources confirmed that the company solicited and received several specific proposals before Thanksgiving, and company officials were reported to be actively looking at options for new space in Boston, Atlanta and Austin, Texas.

“Obviously, North Carolina came in with the total best package,” Whitehurst said, noting that incentives were key to the decision to remain in Wake County.

“Without incentives, we would not have been able to stay here,” he said. “We work for a public company. I have to look my board of directors. I have to look the shareholders in the eye and say I got the best economic deal.”

“This has been an aggressive competition,” Perdue said. “It’s one I got personally involved in. I did everything but cook (Whitehurst) a home-cooked meal.”

Given the size of the company’s request, developers from Raleigh, Durham and the Interstate 40 corridor have offered packages that include construction of a building with Red Hat serving as the anchor tenant, sources said.

City of Raleigh officials were “totally engaged” in keeping Red Hat in Raleigh, said Harvey Schmitt, chief executive officer of the Greater Raleigh Chamber of Commerce.

“We have put our best foot forward,” added Raleigh Mayor Charles Meeker. He said he remains “hopeful” that Raleigh will win the corporate recruiting battle.

One source said that N.C. State representatives keep asking Red Hat for a time-line about its decision making process but as of Tuesday had not been told anything specific.

Durham officials issued a statement Monday afternoon to thank Red Hat for considering moving to the American Tobacco Campus in downtown Durham and expressing delight that the company would remain in the Triangle.

• Reporters: Rick Smith, Bruce Mildwurf
• Photographer: Tom Normanly
• Web Editor: Matthew Burns

Get the latest news alerts: Follow LTW at Twitter.