If you're looking for a high-paying job in a high-tech or science field, you might think your best bet is to head to Silicon Valley, home to many tech giants and startups. But you'd be wrong. Yes, there are plenty of six-figure tech jobs in places like San Francisco and San Jose. The problem is that six figures is barely enough to cover your everyday expenses in these high-priced locales. 

The good news is that there are plenty of tech and science jobs with six-figure salaries in a whole lot of cities with more reasonable cost of living (and perhaps more reasonable traffic) than you'll find in Silicon Valley. The personal finance site GoBankingRates has done the math, comparing the percentage of STEM jobs and average STEM salaries over $80,000 a year to find the 20 best U.S. cities for landing a high-paying tech job outside of Northern California. 

You can find the full list here. These are the surprising top contenders:

1. Lexington Park, Maryland

Average STEM salary: $109,093 

This is far and away the city with the highest percentage of well-paying STEM jobs--a whopping 22.9 percent of the city's jobs are are high-paying STEM jobs. That's almost one out of every four. One big reason for these jobs is the presence of the Patuxent RiverNaval Air Station. Not only does the military base itself require a lot of STEM expertise, so do the large employers with offices nearby to serve the Navy, including Boeing, Lockheed Martin, and Northrop Grumman. 

2. Huntsville, Alabama

Average STEM salary: $105,533

Huntsville is home to the Redstone Arsenal complex, run by the U.S. Army, which has a missile and rocket program. And Cummings Research Park is occupied by employers including Raytheon, Boeing, AT&T, and IBM among many others.

But perhaps the most intriguing employer here is NASA's Space Launch System, which is developing a heavy-lift launch vehicle with plans to take Americans back to the Moon, and maybe on to Mars. Of course, Elon Musk and Spacex might get there first. 

3. Boulder, Colorado

Average STEM salary: $111,033

Boulder offers the the second highest average STEM salary outside Silicon Valley. Only Washington D.C. has a higher average STEM salary, and you'll face higher costs of living there, as well as some of the worst traffic in the nation. Boulder, on the other hand, offers access to Colorado's stellar hiking and skiing.

Just over 13 percent of Boulder's jobs are tech jobs. Google, IBM, Medtronic, and Qualcomm are just a few of the tech employers there.

4. Washington, D.C.

Average STEM salary: $111,710

The nation's capital offers the highest average STEM salary outside Silicon Valley. On the other hand, you'll need it--it's among the five most expensive cities in the U.S. High-paying STEM jobs make up 10.4 percent of the jobs here, largely thanks to the federal government, which employs a lot of STEM professionals. But large STEM employers in this city also include Lockheed Martin, Verizon, and Comcast.

5. Seattle, Washington

Average STEM salary: $107,090

Seattle is almost a northern outpost of Silicon Valley, with Microsoft and Amazon headquartered in the area and Google a healthy presence. The region's largest employer is Boeing, also headquartered here, and the joint Army and Air Force base Lewis-McChord southwest of Tacoma is another huge STEM employer.

6. Durham, North Carolina

Average STEM salary: $107,735

STEM salaries here are almost on a par with Seattle, but cost of living is a lot lower, which could make Durham an appealing option. STEM jobs make up 9.4 percent of local jobs, again only slightly lower than Seattle's 9.6 percent. IBM, GlaxoSmithKline, and Fidelity Investments all offer plenty of science and tech opportunities. And Raleigh, another high-tech hub, is nearby.

7. Boston, Massachusetts

Average STEM salary: $108,180

This city boasts a high average STEM salary, but it's also among the 10 most expensive cities in the nation (so are Seattle and, of course, Washington, D.C.). Choose Boston if you love New England and all things Colonial, and perhaps also if you're seeking a STEM job in a healthcare field. Nine percent of the jobs here are high-paying STEM jobs, but the area's major hospitals, such as Brigham and Women's Hospital and Massachusetts General Hospital account for a lot of that employment. On the other hand, Dell, EMC, and Boston Scientific are all large local employers.

8. Raleigh, North Carolina

Average STEM salary: $99,773

Raleigh offers somewhat lower average STEM salaries than some of the other cities on this list, including its neighbor Durham. STEM jobs here make up 7.9 percent of local jobs and cost of living is a lot lower than in Seattle, Boston, or Washington, D.C. Research Park is a well-established tech center, and local employers include IBM, SAS, and Cisco Systems are all large local employers.