How to programmatically create node with image file saved from remote source?
Finally have figured out. The following code works fine:

$file = file_save_data(file_get_contents($image_url), file_default_scheme().'://tmp/'.basename($image_url));
$file-&gt;status = 1;
$node-&gt;field_image['und'][0] = (array)$file;

node_save($node);