The discovery suggests that, contrary to popular belief, fatty adipose tissue can benefit the body's metabolism.
Research showed how the gene, ChREBP, resists diabetes by converting glucose sugar into fatty acids. It also boosts sensitivity to insulin, the vital hormone that regulates blood sugar.
In most obese people, sugar is blocked from entering fat cells and blood sugar levels rise.
Eventually, this leads to insulin resistance and type-2 diabetes, which affects more than two million people in the UK. Sufferers who cannot control their condition through diet and exercise alone end up on drugs or having to inject insulin daily.
Scientists believe the findings could lead to new treatments for diabetes and other metabolic diseases.
They add to previous research based on 123 fat samples from non-diabetic people, which showed the gene was more active in those whose bodies had a better sugar balance.
The fat gene's activity also correlated with insulin sensitivity in obese, non-diabetic people.
"The general concept of fat as all bad is not true," said lead investigator Dr Mark Herman, from Harvard Medical School in the US. "Obesity is commonly associated with metabolic dysfunction that puts people at higher risk for diabetes, stroke and heart disease, but there is a large percentage of obese people who are metabolically healthy.
"We started with a mouse model that disassociates obesity from its adverse effects."
About 237,468 people in Scotland were living with diabetes at the start of 2010. The vast majority of cases – up to 85% – are type 2 diabetes, which is linked to obesity.
Dr Herman's team tweaked a "glucose transporter" gene in obese mice that serves as a gateway for sugar. Usually, its activity in fat cells drops with obesity.
The scientists found that when they increased glucose transporter levels in obese mice – allowing more sugar into their fat cells – they were protected against diabetes.
Conversely, normal-weight mice that were missing the glucose transporter gene developed diabetes symptoms.
The research showed that sugar in fat cells triggered a response from the ChREBP gene that regulated insulin sensitivity throughout the body.
The findings appear in the online edition of the journal Nature.
Commenting on the study, Professor Ulf Smith, from the University of Gothenburg in Sweden, who is president of the European Association for the Study of Diabetes, said: "It's a really exciting finding."
Eight years ago, scientists learned that when fat cells start to have trouble taking in sugar, it can be an early indicator of diabetes.