A state law passed in 2010 that allows Massachusetts vintners to sell bottles of wine at farmers markets has opened up new venues for fledgling local wineries, and has also spurred the opening of new wineries.

“We’ve been open 10 years, but in the last two years things have really taken off,” said John J. Samek, owner of the Hardwick Vineyard & Winery.

The winery, at 3305 Greenwich Road in Hardwick on the town’s border with Ware, has always relied on drawing tourists to its idyllic rural setting, which includes a bed and breakfast and a restored farmhouse for events. Mr. Samek said the ability to sell wine at farmers markets and agricultural events has boosted not only wine sales but also visibility, which has prompted more foot traffic to the farm. He said in the last two years he’s seen production and sales increase at his winery by 40 percent.

“Direct sales in Massachusetts, of course, for farmers, are really important. So there were a number of other states that were allowing wine sales at farmers markets; I think probably at the time there were at least about 10 or 12, and we kind of looked at that,” said David Webber, the state farmers market program coordinator at the Massachusetts Department of Agriculture. “The wine growers and their association were interested to allow sales at farmers markets.”

In 2011, the first full year in which farmers market sales were allowed, participating wineries showed an average increase in sales of 66 percent over 2010, according to statistics collected by the Department of Agriculture.

The legislation that made this boom in local wine sales possible didn’t happen overnight, or from a sudden burst of good will from the state. The bill was initiated and pushed by a determined association of local wine producers.

The Massachusetts Farm Winery Growers Association, established in 2007, is the first farm wineries group in the state to effectively organize members from across the state into a body capable of coordinating economic and political action. In just a few years, the association has worked with the state to create a tourism-oriented wine and cheese trail, boosting traffic at many rural wineries, and successfully passed the farmers market legislation.

“Most of us knew that we had to unite and make a financial effort to make this all work,” said Mr. Samek, a founding member of the association. “We knew we couldn’t get Boston to go along with these changes without organizing.”

Drawing on the tourism value of farms scattered throughout the state and the enthusiasm for local farmers markets has been a winning strategy for the relatively young organization, which now includes more than 30 farm wineries in the state.

“The buy local movement in general has really been a key to success for a variety of commodities; wine is just one of them,” said Kimberly LaFleur, executive director of the association.

Wineries in Massachusetts don’t produce enough wine to attract big distributors, and there is widespread confusion about the so-called three-tier distribution system that was created after the repeal of Prohibition in 1933.

Officially under the national system, a winery can only sell to a distributor, a distributor can only sell to a retailer and only a retailer can sell to individual wine consumers. Over the years, the system has been carved up in a variety of ways, but the legacy of the distribution system has tended to benefit the distributors at the expense of the producers. In response to the growing power of distributors, who tend to favor California wines on price and volume, individual states have opened up avenues to help local producers continue to operate.

“The types of licenses they had, they weren’t allowed to sell bottles of wine off premise themselves, directly. So they couldn’t go to events, they couldn’t go to farmers markets, and there had been interest for a while for them to do that,” said Mr. Webber, from the state’s Department of Agriculture.

In the department’s most recent report on the state of the wine industry in Massachusetts, based on 2007-10 data, the volume of wine production increased 21 percent, to 134,724 gallons, over the three-year period. During the same period, the industry added seven farm wineries and increased sales by $1.5 million, a 19 percent increase over 2007.